OSL normals

Newtek Lightwave 3D (exporter developed by holocube, Integrated Plugin developed by juanjgon)

Moderator: juanjgon

Post Reply
baltort
Licensed Customer
Posts: 72
Joined: Mon Jul 07, 2014 4:00 pm

Hi all,

I've been playing around with OSL textures and trying to generate some normal maps. I'm seeing some weird behaviour which I'm hoping someone can shed some light on.

Here's a simple scene with a white diffuse model:
basic diffuse.jpg
Next I've created a simple (REALLY simple) OSL texture that just sets the colour to the Geometric normal of the surface. I've applied the texture to the diffuse channel and it looks like the kind of thing one would expect:
Ng applied to diffuse.jpg
Finally I applied the Geometric Normal texture to the texture slot on the diffuse material. I was hoping this would do nothing and render like the first image, but it's getting strange artifacts:
NG applied to normal.jpg
Does anyone know what's going on? Do I need to transform the geometric normal in OSL to something else?

Cheers,

James.
User avatar
juanjgon
Octane Plugin Developer
Posts: 8867
Joined: Tue Jan 19, 2010 12:01 pm
Location: Spain

Perhaps the problem is that you need to declare the output as "vector" or "normal", not as "color"
https://docs.otoy.com/StandaloneH_STA/S ... rTypes.htm

Thanks,
-Juanjo
calus
Licensed Customer
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

juanjgon wrote:Perhaps the problem is that you need to declare the output as "vector" or "normal", not as "color"
https://docs.otoy.com/StandaloneH_STA/S ... rTypes.htm

Thanks,
-Juanjo
it would make sens but as far as I know octane OSL texture only support color output.
Pascal ANDRE
baltort
Licensed Customer
Posts: 72
Joined: Mon Jul 07, 2014 4:00 pm

Thanks all,

No dice, I'm afraid. Changing the output to a vector gives this:

error: Signature mismatch, expecting a shader with 1 output of type color.

Cheers,

James.
baltort
Licensed Customer
Posts: 72
Joined: Mon Jul 07, 2014 4:00 pm

I think I've got to the bottom of this...

The Octane materials expect normal maps in tangent space rather than 'common' or 'world' space. This means that if you want a null map (i.e. a normal map that doesn't change anything - a good starting point for something that does!) you need to supply a map that points purely in the Z direction. The added hook is that the vectors are normalised so that each component lies in the range (0,1) rather than (-1,1). As such, linking the normal map to an OSL node (or an RGB node) that just outputs the colour (0.5, 0.5, 1.0) gives a result that matches a material with no normal map.

This is a long winded way of saying (0.5, 0.5, 1) is the colour of a normal map that does nothing at all.

Next week I shall investigate why 0 is the correct amount to enter into an ATM when you don't want to take any money out...

J.
Post Reply

Return to “Lightwave 3D”