POV-Ray : Newsgroups : povray.general : Generate New Kind of Normal Map : Generate New Kind of Normal Map Server Time
26 Apr 2024 14:06:43 EDT (-0400)
  Generate New Kind of Normal Map  
From: Josh
Date: 11 May 2020 13:25:01
Message: <web.5eb98959b86ff09fdc1270cd0@news.povray.org>
Hi all,

I was able to create a good looking normal map thanks to the great discussion
and code in the following thread. Thanks for that!

http://news.povray.org/povray.binaries.images/thread/%3Cweb.5d9699cfbd113864eec112d0%40news.povray.org%3E

This works perfectly for certain shapes: spheres, cones, etc. But for shapes
where the surface is very distorted, I need a different effect.

Imagine for example a sphere with very bumpy/distorted surface where on the far
left of the sphere where the normal would normally be pointed almost directly
left, because of all the surface distortion, it is actually pointing right.

The code above renders the normal right as expected.

However, if you place a light to the far right, this point wouldn't be lit by
the light since it is on the far left of the sphere and blocked by (in the
shadow of) the main body of the sphere.

So I would want that pixel's left-right (red) value to be 127 (not pointing left
or right), since if a light was either on the left or right of the object that
pixel wouldn't be lit.

I was able to get decent results by simply rendering the scene two times, once
with red and green lights left and top, and once with red and green right and
bottom, and then using image editing software to invert the second image and
then combine the images.
  #case(2)
    light_source { <-50,0,0>  color rgb <1, 0, 0> /*shadowless*/}
    light_source { <0,50,0>  color rgb <0, 1, 0> /*shadowless*/}
  #break
  #case(3)
    light_source { <50,0,0>  color rgb <1, 0, 0> /*shadowless*/}
    light_source { <0,-50,0>  color rgb <0, 1, 0> /*shadowless*/}
  #break

I'm looking for better results and a more elegant solution if possible.

1) Does anyone have any ideas about how such a Normal Map could be rendered
directly? (Like a the example above, but normals that would normally point in a
direction but are in a shadow from light in that direction are given a value of
127...

2) If that's too hard I would just like to improve my results. I still could
render the Normal Map above, and then render a Mask for it and run it through
image software to create the final result. How would I render a Mask for the
normal map generated above? I am envisioning a render where every pixel has a
value proportionate to the amount of light falling on it from each cardinal
direction (left, right, top, bottom)? Maybe just the correct settings for finish
would achieve this, but I'm not very knowledgable in all the settings...

Hope that makes sense!

Josh


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.