Hi, all!
While doing my water I implement waves, and generate normal/tangent/binormal for them. But unlike Godot I can't find a way to use them for lighting
the water surface. How can I do the lighting in Ogre? Should I do it manually in every shader or is there something which can help me?
How to light objects with shader programs?
-
- Bronze Sponsor
- Posts: 148
- Joined: Fri May 23, 2025 5:04 pm
- x 5
How to light objects with shader programs?
-
- Bronze Sponsor
- Posts: 519
- Joined: Sun Jan 18, 2015 4:20 pm
- Location: Buenos Aires, Argentina
- x 188
Re: How to light objects with shader programs?
What do you mean?
How is the process in Godot?
-
- Bronze Sponsor
- Posts: 148
- Joined: Fri May 23, 2025 5:04 pm
- x 5
Re: How to light objects with shader programs?
In Godot you output PBR stuff into variables and engine does lighting stuff itself by generating shader for that.
In Ogre I guess I need to do everything myself for every shader or maybe is there some way I missed?
-
- OGRE Team Member
- Posts: 2204
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1188
Re: How to light objects with shader programs?
things are similar in Ogre, but you have to query the variables via a C++ module, like:
Code: Select all
ParameterPtr positionIn = vsEntry->resolveInputParameter(Parameter::SPC_POSITION_OBJECT_SPACE);
-
- Bronze Sponsor
- Posts: 148
- Joined: Fri May 23, 2025 5:04 pm
- x 5
Re: How to light objects with shader programs?
By that I mean the following:
In Godot I just put ALBEDO = vec4(1.0, 1.0, 0.0, 1.0); NORMAL = vec3(0.0, 1.0, 0.0); in shader program, and Godot appends lighting code itself.
In Ogre I tried enabling per pixel lighting and had no effect, so I had to implement gl_FragColor = vec4(color.xyz * dot(normal, dirLightDir), 1.0); myself.
Which kind of seems wrong thing to do but works. And I found no other working solution. Would be nice to have some intelligent macro system for basic things.
-
- Bronze Sponsor
- Posts: 148
- Joined: Fri May 23, 2025 5:04 pm
- x 5
Re: How to light objects with shader programs?
paroj wrote: Mon Jul 07, 2025 2:29 pmthings are similar in Ogre, but you have to query the variables via a C++ module, like:
Code: Select all
ParameterPtr positionIn = vsEntry->resolveInputParameter(Parameter::SPC_POSITION_OBJECT_SPACE);
That one is too hard for my poor little brain without example