Ah, I forgot about the properties panel.
Also thank you for investigating.
Ah, I forgot about the properties panel.
Also thank you for investigating.
Iâve got another problem:
This time, Iâm trying to use the LightDirection WorldParameter and itâs always 0.
I confirmed this with a basic MoveNode which, well, moves stuff based on the input. If I select LightDirection as input, my model doesnât move.
Iâve added âLightMode MultiPassâ directly under the âTechnique {â line manually.
My test scene has a directional light, which is confirmed by a neighbouring model using the common Lighting.j3md.
Should I go furhter into detail on my situation or can you provide me with a simple working example using LightDirection?
The only one i know is Lighting.j3md.
Iâll look into this.
Thank you.
I really want to try it, because I think itâs the last thing separating me from a shader for DirectionalLighting using ShaderNodes
Oh my god.
I just solved it.
My shader was correct.
But somewhere in the docs I found:
g_LightPosition : the position of the light use for DirectionalLight : strangely enough it's used for the direction of the lightâŚthis might change though.
What the fuck?!
I often say how awesome this community is and how fast and good questions get answered. Which is true. Great work guys; I really mean it!
But itâs stuff like this that sometimes annoyes the heck out of me.
Why canât just be the light direction in LightDirection?! Or some notice appear somewhere that for DirectionalLighting this is reversed?
AhrgâŚ
Please forgive me my little rant. Iâm just upset that the cause was this trivial on the one hand and this hard to find on the other.
Sorry, I knew about that.
But for the record you were talking about AmbientLightColor from the beginning, you never mentioned g_LightPosition. It may seems obvious to you but describing the obvious may get you correct answers faster.
The history of this thing is that when the lighting shader was implemented, only point and directional light were implemented.
One need the light direction and the other the light position. Since both of those variable are vec3 and, for the sake of optimization the same variable has been used. And it was called g_LightPosition.
Then one day I implemented spot light ⌠and spot light need both position and direction. So I introduced a second variable g_LightDirection and to avoid breaking user code I did not change the DirectionalLight inconsistency.
But thatâs good youâre talking about it because 3.1 is gonna break user code anyway. So Iâm gonna change this.
@nehon said:Since both of those variable are vec3 and, for the sake of optimization the same
Drivers are allowed to remove unused uniforms. I know that my OSX do it. Donât know about mobile but for desktop I donât think there was any optimization achieved
There was in the shader code. Because what ever the light type the relevant data was in the same variable.
This avoided branching in the shader.
@nehon said: There was in the shader code. Because what ever the light type the relevant data was in the same variable. This avoided branching in the shader.
Aaah, I see. That makes sense.
@m41q said: I've got another problem:This time, Iâm trying to use the LightDirection WorldParameter and itâs always 0.
I confirmed this with a basic MoveNode which, well, moves stuff based on the input. If I select LightDirection as input, my model doesnât move.
@m41q said: Should I go furhter into detail on my situation or can you provide me with a simple working example using LightDirection?
@nehon said: But for the record you were talking about AmbientLightColor from the beginning, you never mentioned g_LightPosition.
For the record, I was talking about AmbientLightColor from the beginning, but then made a post about LightDirection. Maybe I shouldâve split the threadâŚ
Anyways, itâs okay. I fixed it in my code and youâll fix it in 3.1, so everythingâs good now.
Well sorry I might have slip through the post and my brain replaced LightDirection with AbientLightColor
I finished my Directional Lighting Shader using shader nodes:
The result:
It supports diffuse and and specular lighting as well as different light colors and and a diffuse color. Since itâs made with ShaderNodes, this is easily tweakable however.
My implementation is very simple and basic. However if someone else wants to use it/improve it, I can of course upload the Nodes as well as the final .j3md.
Cool!! nice work