Shader request

General questions about Indigo, the scene format, rendering etc...
Post Reply
5 posts • Page 1 of 1
User avatar
delle
Posts: 175
Joined: Fri Apr 13, 2007 11:32 pm
Location: Italy

Shader request

Post by delle » Sat Nov 08, 2008 3:36 am

Hi to all, I'd like to learn Indigo Shading Language.

Since there is no tutorial available except the API Reference, I ask to some good fellow to try to help me to develop the shader that created this Picture "Shader.jpg". (of course not created with Indigo) :wink:

It uses one texture (Texture_Decal.png) to blend two different textures (Texture_01.png and Texture_02.png). The result is used for the Diffuse Albedo.

Note: I don't want to blend two different materials with a texture, I want to create a new triplet (RGB) to use it as albedo, bump, displace... with a shader.

I know that I can blend two materials but I want to learn ISL
:wink:

Thank you.

Delle
Attachments
Shader.jpg
Shader result
Shader.jpg (161.03 KiB) Viewed 2620 times
Texture_01.png
Texture_01.png
Texture_01.png (35.71 KiB) Viewed 2620 times
Texture_02.png
Texture_02.png
Texture_02.png (83 KiB) Viewed 2620 times
Texture_Decal.png
Texture_Decal.png
Texture_Decal.png (47.08 KiB) Viewed 2619 times

MSUdom5
Posts: 159
Joined: Sun Jul 20, 2008 6:04 am
Location: Mississippi, USA
Contact:

Post by MSUdom5 » Sat Nov 08, 2008 4:42 am

Hi delle,

This one is pretty simple and can be achieved with this code:

Code: Select all

def blend(vec3 tex1, vec3 tex2, real blendamt) vec3: add(mul(tex1,blendamt),mul(tex2,sub(1.0,blendamt)))

def eval(vec3 pos) vec3 : blend(sample2DTextureVec3(0,getTexCoords(0)), 
                                               sample2DTextureVec3(1,getTexCoords(0)),
                                               doti(sample2DTextureVec3(2, getTexCoords(0))))
Basically, the blend function returns a new rbg vector with the blended color. It samples the two rbg textures, and returns a combination of the two based on the "decal" texture.

And with ISLPreviewer, you can try things like this quickly. :)
Attachments
shader.jpg
shader.jpg (131.74 KiB) Viewed 2596 times

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Post by CTZn » Sat Nov 08, 2008 7:05 am

Awesome, dude !

What about adding buttons in the texture manager to change textures positions (or click'n'drag over new positon) ? Maybe not usefull for simple shaders, but if it's a complex one, that could save some hassle I guess.

Low priority req anyway :)

(doh I thought I was in the islp thread )
Last edited by CTZn on Sat Nov 08, 2008 8:55 pm, edited 1 time in total.
obsolete asset

User avatar
delle
Posts: 175
Joined: Fri Apr 13, 2007 11:32 pm
Location: Italy

Post by delle » Sat Nov 08, 2008 8:43 pm

Thank you MSUdom5!

Delle

User avatar
Kram1032
Posts: 6649
Joined: Tue Jan 23, 2007 3:55 am
Location: Austria near Vienna

Post by Kram1032 » Sat Nov 08, 2008 8:53 pm

nice :D

Post Reply
5 posts • Page 1 of 1