About Store Forum Documentation Contact



Post Reply 
Getting pixel color from terrain.
Author Message
b1s Offline
Member

Post: #1
Getting pixel color from terrain.
Hello.
I was just wondering...
For grass it would be very useful to be able pickup the color of the terrain texture pixel that's right underneath the grass object.
Can this be done somehow?
I would settle with overall color of the texture also or something.
06-18-2011 09:31 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Getting pixel color from terrain.
there is function for accessing heightmap material at specified position, check game/area.h, game/world.h look for hmMaterial or something

once you have material you can use its manually set "user_type" enum (you can set this to custom enum values), or you can lock the base_0 texture of material, read colors, and unlock it. avoid doing this real-time as locking/unlocking reading pixels may be slow.
when locking you can access last mip map, this usually should have 1x1 texel size and already have the average color of the whole texture.
06-18-2011 12:51 PM
Find all posts by this user Quote this message in a reply
Post Reply