[Solved] NewtonCreateHeightFieldCollision: unsigned short?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

[Solved] NewtonCreateHeightFieldCollision: unsigned short?

Postby Dalon » Thu Apr 23, 2009 6:02 pm

Hi,

i tried NewtonCreateHeightFieldCollision and I really like it :D

But I don't like the use of unsigned short* because I loose some details =/ For example... I work with etm (2.3) and it saves the height-values using float (0.0 for the lowest value and 1.0 for the highest) and simply has a scale factor for the height.

Is there any way to keep the terrain details?

Image
Last edited by Dalon on Sun Apr 26, 2009 5:34 am, edited 1 time in total.
Dalon
 
Posts: 3
Joined: Sat Mar 28, 2009 5:42 pm

Re: NewtonCreateHeightFieldCollision: why unsigned short?

Postby Aphex » Fri Apr 24, 2009 4:09 am

65 thousand discrete levels is probably enough for most landscapes... does yours cover a large height range?
Can you not just scale your float value by (2^16)-1 then add an offset?
Aphex
 
Posts: 144
Joined: Fri Jun 18, 2004 6:08 am
Location: UK

Re: NewtonCreateHeightFieldCollision: why unsigned short?

Postby Dalon » Fri Apr 24, 2009 4:59 pm

Possible heights are 0 - 1875 Ogreunits... But the details are a bit high... well just a difference of 0.1 units will be visible...
Dalon
 
Posts: 3
Joined: Sat Mar 28, 2009 5:42 pm

Re: NewtonCreateHeightFieldCollision: why unsigned short?

Postby JernejL » Sat Apr 25, 2009 10:41 am

If you need more precision, you can stack several heightmaps on top of each other.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: NewtonCreateHeightFieldCollision: why unsigned short?

Postby Dalon » Sat Apr 25, 2009 3:28 pm

Wouldn't that be a bit too... ehm complicated?

Edit: Solved it... I now just multiplicate the float values by 8 and set the y-scale value to 0.125 instead of 1.0
Dalon
 
Posts: 3
Joined: Sat Mar 28, 2009 5:42 pm

Re: [Solved] NewtonCreateHeightFieldCollision: unsigned short?

Postby Leadwerks » Wed May 13, 2009 8:56 am

When working with a large set of data like this, you would each point to be stored in the fewest number of bytes possible. 8 bytes doesn't give you enough fidelity, but 2 bytes allows about 65,000 possible values. Mulitply your float values (assuming they are 0-1) by about 65,000 (8192*2*2*2, I forget the exact number) and you will have a short value.

I'm using terrain extensively, and the way Newton has it implemented is very smart.
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 19 guests

cron