Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] 'Fix Object Scale' function

Author
Message
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 2nd Aug 2007 03:42
Ever since I first started using DBP scaling has caused me nothing but trouble. Despite the improvements scaling can still cause problems. Worst of all, I think, is that there is no easy way to fix the scale of the object.

Here it is, courtesy of Lost in Thought. He wrote the bulk of the code, I just packaged it into a friendly function. It uses the DBP vertex commands to scale the object permanently by whatever scale you wish on each axis. You pass it percentages, just like the native Scale Object command takes. So, 200=2x.

It will work on animated and non animated object alike. You can permanently scale and object then save it too. Interestinly, this function will also correctly update the bounding box, unlike scaling the object. I inserted a 'Calculate Object Bounds' command in order to do so and it worked correctly. That should mean that permanently scaled objects will cull correctly, unlike the default behavior which is unpredictable at best with heavily scaled objects. Test it out and let me know if the bounding boxes are correct for the scaled objects.

Warning - it's slow, so use it sparingly. I don't use it in Geisha House at all, I pre-scale and save.




Come see the WIP!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 2nd Aug 2007 11:29
Nice snippet. Is it really this simple? It seems too good to be true.

I'm trying to think of a situation where it would fail, but I can't.

Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 2nd Aug 2007 12:17
Thanks Jess T!

@Batvink -
Cool I don't have DBP right now so I can't do any testing on it. I'm particularly interested in the bounding boxes of the permanently scaled objects vs. the bounding boxes of regular scaled objects. It seems too simple to me too - 'Calculate Object Bounds' appears to correctly size the bounding box. When scaling an object significantly the bounding boxes don't scale properly. It appears that actually moving the vertices out fixes this problem. If you guys test this out that would really shed some light on it. I'm hoping that it works every time. It worked correctly on an animated object.


Come see the WIP!

Login to post a reply

Server time is: 2024-11-22 19:10:46
Your offset time is: 2024-11-22 19:10:46