Page 1 of 1

ModMaterial (customize shader)

PostPosted: Sunday, 13.October 2013, 04:49
by ikam
Hi

I need a tester for an extrem new cool feature :)

I have modified modmaterial operator. You can now edit the final shader code to modify as you want the shader or add special fx like in custommaterial :)

use this prototype and read comments in example file.

thanks

Re: ModMaterial (customize shader)

PostPosted: Sunday, 13.October 2013, 13:13
by Skinnytorus
OK. I'll have a look. I don't understand shaders that much, but I'll give it a go ;)

Re: ModMaterial (customize shader)

PostPosted: Sunday, 13.October 2013, 13:48
by Skinnytorus
Weird behaviour. Have a look.

Re: ModMaterial (customize shader)

PostPosted: Sunday, 13.October 2013, 15:44
by ikam
If you have lights : You need to modify the shader only when you have shown your scene with lights. (2nd comment)

1. render your scene in the final stage of your stack
2. press Get the the shader code from modmaterial only at this moment
3. add your custom code and enable custom code and it is ok.

(lights modify initial materials of objects to add light and shadows instructions it is why you need to get the code only at this moment)

Re: ModMaterial (customize shader)

PostPosted: Sunday, 13.October 2013, 16:54
by Skinnytorus
Thanks. Now it's working, but there's too much light now. Why is that?

Re: ModMaterial (customize shader)

PostPosted: Sunday, 13.October 2013, 17:06
by ikam
change += to *= for the last line. i forgot to update the script code in the comment. :)

Code: Select all
o_color *= result;

Re: ModMaterial (customize shader)

PostPosted: Sunday, 13.October 2013, 17:19
by Skinnytorus
Yey! It's now working. Thanks. Since I'm not into shader coding, I can't see much potential in this feature, but overall, this is awsome that people can edit shaders on the fly :). Another leap forward. Congrats! =D>

Re: ModMaterial (customize shader)

PostPosted: Sunday, 13.October 2013, 17:32
by ikam
potential is huge :p

You can add all you want to complete modmaterial missing features. for example you can add fx (remebber those one used in customipp like tunell, plasma metaball etc ) only applied to the diffuse texture or emissve or any others... For example last new mod operators (sinwas and twist ) could be added manually here. So you can code what you want.

It is a mix with custommaterial and modmaterial, but instead of writing all the shader you can only complete it or modify as you want the modmaterial.

It is also a sandbox to test or debug some next mod feeatures before to add them in hard with operators

Re: ModMaterial (customize shader)

PostPosted: Sunday, 13.October 2013, 17:36
by Skinnytorus
Very well. That is why I'm glad it's there. As for the potential, I meant myself (personally). I'm totally blind to code ](*,)

Re: ModMaterial (customize shader)

PostPosted: Sunday, 13.October 2013, 17:48
by ikam
:) Honestly I think this is probably the best feature with materials in wz =)

Re: ModMaterial (customize shader)

PostPosted: Sunday, 13.October 2013, 17:58
by Skinnytorus
Good for you :)

Re: ModMaterial (customize shader)

PostPosted: Saturday, 19.October 2013, 20:18
by nikitos75
sorry, Ikam, can I make real reflection with it?

Re: ModMaterial (customize shader)

PostPosted: Sunday, 20.October 2013, 08:40
by ikam
You can use the shader of the water reflection example, yes. didn't test it, but should work.
Real reflection for a non planar mesh is always the same : env reflection (supported) or raytracing (not implanted)

Re: ModMaterial (customize shader)

PostPosted: Sunday, 20.October 2013, 18:20
by nikitos75
Ikam, can you, please, implement:
1. Possibility to add unlimited number of lights to scene ( now only 8)
2. Add " multiply mesh with light" like was in wz3

Re: ModMaterial (customize shader)

PostPosted: Sunday, 20.October 2013, 19:27
by ikam
there is 8 lights per material, but you can have multiple modlight per scene, so infinite number of light in a scene...

But yes multiplying lighting should be nice and easier, maybe a ModLightMultiply operator, I will study that.

You also can use CustomMaterial (or edit shader of modmaterial) and add your own lighting, multiply works fine is this case.

edit : another idea, maybe a light operator to stack to the modmaterial this will add a light per object. multiplying should in this case too. I will try that too.