Game Development Community

Render Terrain Normals?

by C. N. · in Torque Game Engine · 08/14/2008 (12:53 am) · 3 replies

Hi,

I've been trying to render the 'normals' from terrain data.

I think the closest clue I've found is in the EdgePoint struct in terrRender.h:

#if TERRAIN_STORE_NORMALS
Point3F vn; // <- Can this be rendered? Am I in the wrong place?
#endif

I know that the normals are used for many things (especially collision and lighting), but is it possible to have these normals rendered in World Editor mode (just with GL lines)?

I plan on attaching nodes for pathfinding to the 'tips' of the normals. I'd like to render them for visualization purposes.

I humbly appreciate any insight...

Kind regards,

Chris

Edit: Hmm, it just hit me that those normals would probably change during CLOD, making them unusable for a path grid, even if they were stored?

#1
08/14/2008 (1:09 am)
Not sure about LOD, but those normals are correct at least for the topmost mesh. You can safely uncomment the parts in emit () where the normals used to be generated.
#2
08/14/2008 (1:19 am)
Emit()?

I'm having trouble locating that function... a global search didn't turn up anything.

I found this: TerrainRender::emitTerrChunk().

I'll go through that, for now... was that where I should look?

Thanks for the response.

EDIT: I though it would be in void TerrainRender::renderBlock()? I'm not even sure what a block looks like... is that the four squares joined with a big X attaching the outermost corner of each?
#3
08/14/2008 (2:59 am)
Yeah, there is commented code in that function, at least in TGEA, and possibly a few others. I don't know how to render them in TGE though, as in TGEA you pretty much just throw them onto the shader in the vertex definition.

Good luck.