+2
Under review

Split components of Normal Dir.

Andrei Nadin fa 11 anys updated by Freya Holmér (Developer) fa 11 anys 9

I am about to do a slope based multi-texture shader for a procedural RTS style level, I wanted to start with 1 - Normal Dir (Y) that I could compare to ranges to decide how much lerping between textures. Is is possible to split the Y out of the Normal Dir. or would we need some way of getting it from the Normal Dir node? (sorry if this is a stupid question) :)

Hmm, maybe the G channel of the comment mask? 

You answered your own question! But perhaps it would be appropriate to have the actual channel outputs on the normal dir node as well. I'll consider it!

Yup, thanks, in the end I'm going triplanar but actually this one is new to me, stuck in the IF node now, I assume IF is a pretty expensive thing to do?

It's not that expensive, it doesn't do any branching, but it evaluates all inputs. Just make sure the instruction count doesn't go through the roof :)

he he, yeah, OK, so I am a more confused now, sorry to hijack this thread.


I want IF to have three outputs based on my test I would have to nest them


I want to do 

LERPA if test A<B

LERPB if test is >A && <B

LERPC if test is >B


eek, sure I am doing this wrong :D





Remember, shaders are done on a per-fragment/pixel basis, so the conditions are checked for each fragment. If A > B, then it will output whatever is in the A > B input, and so on for the rest :)

Yeah this isn't going to work, previously I have done this with vertex colours but I was trying to use slope instead but I think it's going to get messy :)

Doesn't have to be! Abs the Y output from the normals, then multiply it by itself, then multiply that by whatever texture you want on the Y plane. Repeat for all other planes, then add all results together :)

ah, of course, thanks..