How to visualize normals on a ground so it would look like a tangent normal map?

Started by KirillK, July 30, 2012, 07:48:54 AM

Previous topic - Next topic

KirillK

I meant something with a  prevalent blue color. Like normal map textures in games.  I need to make a down looking camera shot of a ground with a normal map to be used in a game?  Getting something bright yellow green with the visualize normals node default settings. Perhaps it should be remapped somehow?

Tangled-Universe

I don't know if this has to do with it, but TG's axis system has Y as 'up' instead of Z.
R=X, G=Y and B=Z. The prevalent colour is then green when you have a top down view and displacements along normal.
R=X, G=Z and B=Y is the conversion you'd need to make in Photoshop for example.

At least, that's my guess :)

KirillK

Thanks.  Need to just swap green and blue channel in Photoshop. Still would be nice to have an option to do the same  in TG.


ps. Not sure if I am right  but looks like TG visualizes normals bsed on world axis.    Would be nice to have an ability to do the same based on camera coordinate system.

Tangled-Universe

I don't have TG2 at hand here, so I'm trying to do this from heart...

Does the visualize normal node has an output? If so you may be able to use 'red to scalar' 'blue to scalar' and 'green to scalar' to split the colours (function node -> convert).
Then build the colour (function node, don't know which type by heart) using the output of the conversion nodes. You can then rebuild the colour in any order you like.

Something along that line.

Then you'd need to create a surface layer, set it's colour to 100% white (1) and set the output of the 'build colour' node as colour function.
Then render your image from top down and you should have your colours right.

Be aware that you only have to figure this out once and that you can save the setup as a clip file for future use/reference.

Does this work?
If so, then I think other people are interested in this too :)

KirillK

I got the idea and found a "build color" node with R,G and B inputs that i hoped to combine the things back but I am getting just black result.

The other thing is the "visualize normals" node visualizes only  iworld coordinates while for games it would be much more useful if it can do the same in current camera axis. Something like visualize normals material in Zbrush or the same kind of material in 3ds max.    Curious if it possible to build from TG nodes somehow?

KirillK

Quote from: KirillK on July 30, 2012, 09:25:13 AM
I got the idea and found a "build color" node with R,G and B inputs that i hoped to combine the things back but I am getting just black result.

The other thing is the "visualize normals" node visualizes only  world coordinates while for games it would be much more useful if it can do the same in current camera axis. Something like visualize normals material in Zbrush or the same kind of material in 3ds max.    Curious if it possible to build from TG nodes somehow?

Tangled-Universe

I need to think about this, but it may be possible.

There are some conditions I can think of already.
Like you would need a heightfield as a base, so only one altitude/height value per pixel, so no overhangs etc.
Then the displacement should not be too rough for similar reasons, otherwise the resulting normal map is inaccurate.

The reason why the previous didn't work, probably, is because the visualize normal node doesn't have 'real' output or the type of data from the node is different from what the conversion nodes accept as input.
The node reference might be of help here.

KirillK

To be honest  I don't understand clearly what input and output data are actually go from one node to another in TG. The help section is too short and simple.   

For camera based things I guess should be something like "get camera/view vector" or something at a start. I didn't find it in the "get" category.  Together with "get normal" it probably could give us a camera Z based channel at first

Tangled-Universe

Quote from: KirillK on July 30, 2012, 10:35:49 AM
To be honest  I don't understand clearly what input and output data are actually go from one node to another in TG. The help section is too short and simple.   
`

Yes that's pretty "under-documented". The node reference, for function nodes, contains pretty consistent and good information on this, but hey...quite logical when the node name says something with scalar that it outputs a scalar value. Not much mystery there compared to other red nodes (non function nodes).

I haven't been able to figure out yet how to adjust the visualize normal output, other than with a colour adjust shader.

Quote
For camera based things I guess should be something like "get camera/view vector" or something at a start. I didn't find it in the "get" category.  Together with "get normal" it probably could give us a camera Z based channel at first

I think you overlooked the 'get camera position' function node.
Also, if you use an orthographic camera to render your map then you'd need a 'get ray origin' node.

See: http://www.planetside.co.uk/wiki/index.php?title=Get_Ray_Origin