Forum

#1 2018-09-02 16:06:55

aboellinger
New member

How to write a new surface shader ?

Hi there !

I am trying to write a surface shader to reproduce light interactions in labradorite stones
I have already figured out the math in glsl playing on shadertoy

Now I want to port it to a surface shader inside guerilla, but I can't figure out how to get started...

I create a surface shader
https://ibb.co/gtk2aK

And a SL box to drive the outColor value.
When my SL box returns a flat color, it works great.
https://ibb.co/b7FSaK

Then start to get started by writing a simple diffuse shader by copying the code sample found in the documentation, and things start to break
https://ibb.co/jwKyhz

Even after correcting a few typos I cannot get rid of the parsing errors, it seems that calling brdf (args) {//whatever}
simply does not work.
https://ibb.co/fwMppe

I am already thinking of a workaround (using a standard surface shader and changing the behaviour of the spec2 normals instead), but I am interested in understanding how this brdf loop works, and generally speaking, how do you implement a brand new shader in guerilla ?

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2008 PunBB