Search - User list
Full Version: How to create a double-sided material in Karma?
Root » Solaris and Karma » How to create a double-sided material in Karma?
cheesetroyer
Can someone explain to me how I can create and apply a double-sided material to in Karma?

I found a post on this forum, but it didn't make it understandable for me.
Enivob
You'd think the kma_ray_import would offer some type of 0-1 output value you could use to drive the bias on a mtlxMix. Can't figure it out yet. Some way to fetch the sign of the magnitude of ray:direction then remap that into 0-1?
jsmack
Enivob
You'd think the kma_ray_import would offer some type of 0-1 output value you could use to drive the bias on a mtlxMix. Can't figure it out yet. Some way to fetch the sign of the magnitude of ray:direction then remap that into 0-1?

N.I plugged into a greaterthan(0) should do it
cheesetroyer
Would someone be willing to give a more detailed explanation on how to do this?
Enivob
I tried this type of setup, but couldn't get it to work. N.I means reference the ray normal and export it using an integer signature, right?
jsmack
Enivob
N.I means reference the ray normal and export it using an integer

no, it means N dot I, as in dot product of the ray direction and the surface normal
Enivob
Getting close with your suggestion. I see some purple, but I need red on one side and blue on the other.
jsmack
Enivob
Getting close with your suggestion. I see some purple, but I need red on one side and blue on the other.

What is the input range of the remap set to? it should be something like -0.000001, 0.000001 to 0, 1 and clamped to simulate a switch. The ifgreater would be a better choice.
jomaro
I don't know maybe this is the setup you are after?
I think this is not yet supported by XPU

jsmack
jomaro
I don't know maybe this is the setup you are after?
I think this is not yet supported by XPU


That node isn't supported in XPU, but it's trivial to emulate it using switches going into a standard material.
Enivob
@jsmack I tried the very small range numbers and very large. The greaterif didn't seem to help either.

I just wonder if the ray_import is actually working?

@jamaro Your method certainly works for CPU only render.
jsmack
Enivob
I just wonder if the ray_import is actually working?

hmm, it's possible that's the issue. There are presets in the menu that should work for getting the ray direction though. I recently used it for making a fresnel blend, since one is missing in the factory node set.
antc
rayimport seems to be working for me with xpu (on Mac OS tho)

jsmack
Working fine here as well.

Enivob
That was it. Thanks, everyone!

I was using ray:hitN instead of mtlxNormal node. I guess hitN is not the same as the geometry normal.
cheesetroyer
Thank you guys very much!
boning
There's a simpler way other then using 2 rayimport and dot product. You can directly using ray:backface to get a bool. This is listed in the documentation of the rayimport node, but don't know why it's not listed in the drop down menu probably is a bug.
CalvinJor
What should I do if I wanna put a roughness or normal texture on it??
alli13
CalvinJor
What should I do if I wanna put a roughness or normal texture on it??

Just use it as a switch input instead of plugging it directly.
YuRock
Thanks for the advice, but what if I need 2 different shaders (materials) on different sides, and not just 2 different pictures, colors?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB