Chaining Lighting technique to shader. What's needed to be passed?

I feel it’s a silly question but that’s not covered in the wiki and searching the forum with Technique Lighting didn’t give me any result explaining it.



I’ve added the “Technique Lighting” to my procedural shader but I’d like to have it lighted. What exactly do I need to pass to the lighting shader technique so it works?



Thanks.

Whatever you like I would start with a vragment and a vertex shader for it , and then the needed uniforms.

Thanks Empire but that doesn’t really help.



Lack of answers tells me I haven’t properly explained myself.



I already have the .vert/.frag and I’ve added the following to my j3md file. As I thought simply adding the “Technique Lighting” isn’t enough, the object won’t be lighted.



So given that, how can I make my shader be lighted?




[ my own shader's stuff ]

Technique Lighting {
VertexShader GLSL100: Common/MatDefs/Light/Lighting.vert
FragmentShader GLSL100: Common/MatDefs/Light/Lighting.frag

WorldParameters {
WorldViewProjectionMatrix
NormalMatrix
WorldViewMatrix
ViewMatrix
CameraPosition
WorldMatrix
}

Defines {
[ stuff ]
}

Getting it out of the way… the standard stuff: Do you have a light? Does your mesh have normals?

I think you don’t get what thechniques do.

Adding the Lighting technique does absolutely nothing if you don’t select it before render.

If no technique is specified to the renderer, it just takes the first one in your j3md.

I guess in your case the first one is the one rendering the procedural texture, am i right?.

I also guess that what you want is to have your procedural texture shader to also have lighting, am I wrong?



In that case you’ll have to merge the 2 shaders and techniques.

1 Like
@pspeed said:
Getting it out of the way.... the standard stuff: Do you have a light? Does your mesh have normals?

Yes to both questions. The scene itself hasn't changed. Only the materials have.

@nehon said:
I think you don't get what techniques do.

I take it they only serve for post processes?


I guess in your case the first one is the one rendering the procedural texture, am i right?.
I also guess that what you want is to have your procedural texture shader to also have lighting?

Yes and yes.


In that case you'll have to merge the 2 shaders and techniques.

Ok... hmmm... I'm not sure how I'll do that but I'll find a way.

Thanks. :D

Well the only other option to combine both shaders wouldbe to do “shader injection”

duck and run (I could bet some people have a notifier on that keyword)

@EmpirePhoenix said:
Well the only other option to combine both shaders wouldbe to do "shader injection"
*duck and run* (I could bet some people have a notifier on that keyword)

lol
...you're right btw.


@madjack, i'd recommend putting your procedural texture code into the lighting shader rather than the other way around.
Add your material params in the lighting material j3md, defines etc...
Then put your code inside the lighting vert and frag shaders. Ofc that's not that easy it has to work :p
I guess your procedural texture just modify the diffuse color of the material, so instead of fetching the diffuse color in the diffuse texture in the lighting shader, put your code.
1 Like

In short, gut the lighting shader out, only keeping the necessary stuff.



Do that 5 more times, or preferably, find a way to make it work for several different texturing ways.



Got it. :wink:

Thanks for the input the lighting is now implemented in solar systems.



Looks great although I’d love to put PSSM on, but since I’m using point lights for stars, it doesn’t really work. Even without the shadows of moons passing in front of their parent planet it’s a pretty sight anyway. :smiley:

lol, i read this as “chain lightning technique shader”…



I was like wooot! sith force lightning! :slight_smile:

@monkeychops said:
lol, i read this as "chain lightning technique shader"...

I was like wooot! sith force lightning! :)


Isn't that a 6th level spell in AD&D? ;)
@madjack said:
Isn't that a 6th level spell in AD&D? ;)



Could be... I don't think this shader works like that though :(