| We hope you enjoy your visit. You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you are already a member please log in to your account to access all of our features: |
- Pages:
- 1
- 2
| deactivating instance when too far | |
|---|---|
| Tweet Topic Started: Dec 12 2012, 11:32 PM (619 Views) | |
| MisuMen | Dec 12 2012, 11:32 PM Post #1 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
I'm trying to come up with something to decrease lag by deactivating those instance that are far from view. and when getting close, they reactivate. How can I accomplish this when I'm using u3d? |
![]() |
|
| Despellanion | Dec 12 2012, 11:47 PM Post #2 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
If the object is static, just deactivate it in the create event once it has finished loading everything. |
![]() |
|
| MisuMen | Dec 13 2012, 12:09 AM Post #3 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
Um no because this instance draws a model. So if I deactivate instance, then the drawing won't reappear again or resets to its normal shape (i scaled this model with u3d). |
![]() |
|
| Despellanion | Dec 13 2012, 12:42 AM Post #4 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
You don't need to have the model object active once it has been loaded, unless you need it to move around, animate or change its materials. |
![]() |
|
| zelda4evr | Dec 13 2012, 07:48 AM Post #5 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
yep, so if at the end of the create event of static models you deactivate them, they will still be visible(collisions still work if I'm not mistaken as well) if an object is dynamic but when it gets too far away becomes static, it can be deactivated by an instance controller. |
![]() | |
![]() |
|
| MisuMen | Dec 14 2012, 02:36 AM Post #6 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
Well my object is static but the problem is that its a block being stretched with scale variables to form itself into a wall. So if you deactivate it in create event, I'll draw it as in its original model form (a block)[Well at least this is how I see its happening in my game so its an assumption] However, I used the CreateLODChain function to lower amount of triangles when at a far distance like this: CreateLODChain(120,8,128,2,148,0); It works great but not enough. The lag is a little noticeable now. I'll try to create a control object to verify whether to deactivate instance or not. But in the meantime, are there any other tricks to avoid any lag in my game? Edited by MisuMen, Dec 14 2012, 02:38 AM.
|
![]() |
|
| Despellanion | Dec 14 2012, 02:43 AM Post #7 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I think you are misunderstanding what I'm getting at. What you do in the create event is
|
![]() |
|
| MisuMen | Dec 14 2012, 01:47 PM Post #8 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
Oopps! I clicked on report button by mistake with quote button.. Sorry. Anyway, I did understood your instructions and I tried but when I tried it and tested, it turned all my floors into cubes since the original model I'm loading (yes, I'm loading models here) is a cube that I then morph it into a floor by using scalx, scaly, and scalz. Thats what I've been trying to say the whole time. So its like cancelling the scale variables which its wierd that it should happen. Anyway, I hope you understand now my prob or there's something i do not understand with your example. |
![]() |
|
| Reikyrr | Dec 14 2012, 04:19 PM Post #9 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I dont think the Scale values should be reset if you deactivate the instance. But I cant think of any other reason why this is happening either. |
|
~Inspirational quote~ | |
![]() |
|
| Despellanion | Dec 14 2012, 04:52 PM Post #10 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
It's the same principle there
I've used this method myself so I know it works. |
![]() |
|
| MisuMen | Dec 14 2012, 09:53 PM Post #11 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
sorry but your example didn't solve my issue for that it causes, still, to mess up my models size. I don't know but I'm now playing around with the mipmaps to see the best results between speed and graphics can solve my issue. And so far, I set my mip map to 3. But it could use more speed though.
|
![]() |
|
| Despellanion | Dec 14 2012, 10:15 PM Post #12 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Then it's something else in your code which messes it up, because I know for a fact that it does work. Just try it with a new clean object without any other code in it. |
![]() |
|
| 57E | Dec 14 2012, 10:27 PM Post #13 |
|
Forum Leader
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I remember having similarish problem when I worked with this method. I don't excatly remember what caused it, but try this:
Just replace the "scalx,scaly,scalz" with the vaules you want to use. Edited by 57E, Dec 14 2012, 10:28 PM.
|
|
| |
![]() |
|
| MisuMen | Dec 15 2012, 12:46 AM Post #14 |
|
Advanced Member
![]() ![]() ![]() ![]() ![]()
|
Yes! That fixed Despellanion's code problem for me, but it seems the lighting is flipped (makes it look like each floor piece is a huge tile) but I bet its the scale that might be a bit inverted, I'll have a look at that. BTW, this code made the mouse view a bit more smoother now, but not fast enough. However, I'm going to search for one of the u3d example files I have in a folder because I remember one example had a Dynamic Speed script. I'm gonna try that to make things more quicker, although it makes it look like a frame skip thing. Oh and I recently added shader effects to the game but my laptop gets overheated by this. Need to find a way to optimize my performance and decrease CPU occurring while playing the game. |
![]() |
|
| zelda4evr | Dec 15 2012, 03:40 AM Post #15 |
|
Forum God
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
sometimes to prevent certain issues I used to use a control object to deactivate the instances but only after an alarm of 2 or more so everything could be properly loaded into the engine and then deactivated. This also allows you to reactivate and again deactivate instances and groups of instances(parent objects help) with ease. Sometimes scaling your entire game down can reduce lag because giant polygons are sometimes slower, so you could make your game scale 1/10 of what it is now. If it is lagging, there has to be compromises made somewhere, if you notice on xbox 360 most textures are pretty low res but they use detail maps to make it look better. A lot of times you can have a very low poly count and still have a great looking game if the textures are made right. |
![]() | |
![]() |
|
| Go to Next Page | |
| « Previous Topic · Questions about Ultimate 3D · Next Topic » |
- Pages:
- 1
- 2





![]](http://z1.ifrm.com/static/1/pip_r.png)




2:21 AM Jul 11