Digital Art Zone

 
     
DS4.5 Shader Mixer - What’s happening with the normals here? PROBLEM UNDERSTOOD, STILL TRYING TO SOLVE!
Posted: 20 October 2012 06:14 AM   [ Ignore ]   [ # 2 ]
Active Member
Avatar
RankRank
Total Posts:  443
Joined  2007-09-01

Since a normal is just a unit vector, it should be easy to calculate the third component (Z, blue) from the other two (X, red and Y, green) using simple trigonometry, B = SQRT(1-((R*R)+(G*G)))
(No, there’s not really any point in doing this, but it’s just the simplest way I found to explain the problem)

That’s what this next network does. (The three bricks in the bottom right are simply to verify that the calculated Z(blue) value matches the Z (blue) output of the splitter brick - it does)

I would expect this network to work too, but it doesn’t!

(Edit: discovered an even simpler demonstration of the problem - see the fifth post (#4) for the network I used)

Image Attachments
NormalsFAIL.jpg
 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 20 October 2012 06:14 AM   [ Ignore ]   [ # 3 ]
Active Member
Avatar
RankRank
Total Posts:  443
Joined  2007-09-01

Here’s the results when you apply the two networks to a sphere primitive (I also tried applying plugging the end result into the Diffuse Color input of a Surface brick, and noticed the difference there too - I include those renders as they may provide a clue).

The renders on the left are from the first network and are as expected.

The renders on the right are from the second network, and I can’t understand why they’re so different.

Image Attachments
WhatsUp.png
 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 20 October 2012 06:28 AM   [ Ignore ]   [ # 4 ]
Active Member
Avatar
RankRank
Total Posts:  443
Joined  2007-09-01

I’ve got to the banging-head-against-the-wall stage with this one.
An explanation as to why on earth the second network behaves so differently, even though the inputs to the final Point brick are to all intents and purposes the same, would be greatly appreciated.

More background in my Simple Material Mixing With DS4.5 Shader Mixer thread.

 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 21 October 2012 01:18 AM   [ Ignore ]   [ # 5 ]
Active Member
Avatar
RankRank
Total Posts:  443
Joined  2007-09-01

I’ve just discovered an even simpler demonstration of the problem - take the ‘Z Component’ output of the ‘XYZ Components’ brick, multiply it by itself, take the square root (so you should end up with the same value as the ‘Z Component’ that you started with) and plug that into the ‘Z Value’ input of the point brick.

That should definitely work, shouldn’t it?

It doesn’t!

I get the same effect as the network in the second post (i.e. renders like the two images on the right in the third post)


To me this makes it clear that it’s not faulty maths that’s causing the problem!

Image Attachments
SimplestFail.jpg
 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 01 November 2012 11:06 PM   [ Ignore ]   [ # 6 ]
Active Member
Avatar
RankRank
Total Posts:  443
Joined  2007-09-01

SOLVED: The output of a Normal Map brick is NOT a tangent-space normal (which is what I thought). It’s the normal in camera-space after it’s been applied to the object.
And by the way, camera space uses a left-handed axis system with the camera’s line of sight being the positive Z axis, so normals for ‘forward’-facing faces will have negative values.

(Addendum: thanks to millighost over in this Renderosity forum thread for the enlightenment)

 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 05 November 2012 12:20 PM   [ Ignore ]   [ # 7 ]
Active Member
Avatar
RankRank
Total Posts:  587
Joined  2005-01-19
3dcheapskate - 01 November 2012 11:06 PM

SOLVED: The output of a Normal Map brick is NOT a tangent-space normal (which is what I thought). It’s the normal in camera-space after it’s been applied to the object.
And by the way, camera space uses a left-handed axis system with the camera’s line of sight being the positive Z axis, so normals for ‘forward’-facing faces will have negative values.

Thanks. I didn’t understand why I obtain results with negative normal and not with positive. I didn’t think about changing axis when space is changed.

 Signature 

Playing with shaders

http://www.daz3d.com/forums/viewthread/20283/

Profile
 
 
Posted: 05 November 2012 04:29 PM   [ Ignore ]   [ # 8 ]
Addict
Avatar
RankRankRankRank
Total Posts:  4524
Joined  2007-09-13
3dcheapskate - 01 November 2012 11:06 PM

SOLVED: The output of a Normal Map brick is NOT a tangent-space normal (which is what I thought). It’s the normal in camera-space after it’s been applied to the object.
And by the way, camera space uses a left-handed axis system with the camera’s line of sight being the positive Z axis, so normals for ‘forward’-facing faces will have negative values.

A lot simpler explanation than what I was working on when I lost power for 4 days…

 Signature 

1432 old posts

My ShareCG gallery.

Just because something costs a lot, doesn’t mean it’s the best…

It just means it’s expensive.

Profile
 
 
Posted: 11 July 2013 10:11 PM   [ Ignore ]   [ # 9 ]
Addict
Avatar
RankRankRankRank
Total Posts:  4727
Joined  2004-08-11

Is there any hope of making a shader brick that creates a normal map for something like my Bruno skin for V4/Genesis/Genesis 02 Female??

 Signature 

    —- Wolff On The Prowl—-

Pan Project

Profile
 
 
Posted: 14 July 2013 06:17 AM   [ Ignore ]   [ # 10 ]
Active Member
Avatar
RankRank
Total Posts:  443
Joined  2007-09-01

There’s always hope!

Is the Bruno texture in question purely shader-based or does it use a texture/bump/displacement map image?

If you’re creating bump/displacement (procedurally or from an image) couldn’t you just use the Normal output from a ‘DS Default Displacement’ brick?

If it’s image-based then you could create a separate normal map in GIMP, etc from your bump/displacement image

Maybe I’m not quite understanding the question…

 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 04 August 2013 06:28 PM   [ Ignore ]   [ # 11 ]
Power Member
Avatar
RankRankRank
Total Posts:  1122
Joined  2005-03-26

Ooh, look!  ShaderMixer puzzle!

RAMWolff - 11 July 2013 10:11 PM

Is there any hope of making a shader brick that creates a normal map for something like my Bruno skin for V4/Genesis/Genesis 02 Female??

I may be tracking something that applies the Displacement Map as a Normal Map….

[EDIT:  No.  False Alarm.  I still know VERY little about Normal Mapping, but I did get some progress toward aligning the Normal-Map with the UV instead of with the camera.]

 Signature 

My dA gallery
For God’s sake!  Gallifrey Stands!

And God still reigns.

Profile
 
 
Posted: 07 August 2013 07:32 PM   [ Ignore ]   [ # 12 ]
Active Member
Avatar
RankRank
Total Posts:  443
Joined  2007-09-01

Go on… do tell! Getting the normals in UV space rather than camera space was THE big problem I had…

 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 07 August 2013 08:26 PM   [ Ignore ]   [ # 13 ]
Power Member
Avatar
RankRankRank
Total Posts:  1122
Joined  2005-03-26

Simple:  Plug the Normal Map and an NTransform brick into a Binary Functional set to Multiply, and set the NTransform at [From: current To: object] and plug it in wherever you need to.

Image Attachments
UV-Mapped_Normals.jpg
 Signature 

My dA gallery
For God’s sake!  Gallifrey Stands!

And God still reigns.

Profile
 
 
Posted: 07 August 2013 10:36 PM   [ Ignore ]   [ # 14 ]
Active Member
Avatar
RankRank
Total Posts:  443
Joined  2007-09-01

Simple’s good! So the NTransform brick is the key - hidden in plain sight! (that’s often my blind spot ;o)
It’s such a long time since I was playing with normals that I’ve forgotten most of it, but it sounds like something along these lines is what I was after. Maybe time to dust off this project and take another look…
Thanks!

 Signature 

Website: UnrealImperfect | Freebies: Renderosity, ShareCG | ‘Art’: DeviantArt | Blog: Blogger
(aka Pete Williams)

Profile
 
 
Posted: 09 August 2013 08:42 AM   [ Ignore ]   [ # 15 ]
Power Member
Avatar
RankRankRank
Total Posts:  1122
Joined  2005-03-26

I’m sorry for the error in my last post:  it should have read “From Current to Object” for the NTransform brick.  The image is right.  Post edited to match.

 Signature 

My dA gallery
For God’s sake!  Gallifrey Stands!

And God still reigns.

Profile