Hello! I continue to dig with a light and there was a couple of questions:
1. Can I install the "power" of a source of light? In the API has not found the right method. At the moment, the source illuminates everything walls, despite the fact that they are located far away.
2. Light manages to pass through walls. Because of this, it turns out that it illuminates even totally enclosed spaces. How to fix it?
Using per-pixel lighting from the article: http://www.ogre3d.org/tikiwiki/tiki-ind ... 20Lighting
Tried to search the forum, but did not find the description of a similar problem.
Thanks.
Questions about the light
-
- Gnoblar
- Posts: 5
- Joined: Sat Jun 08, 2013 7:08 am
- Location: Russia
-
- Google Summer of Code Student
- Posts: 550
- Joined: Thu Jun 04, 2009 5:07 pm
- Location: Berlin
- x 108
Re: Questions about the light
You are searching for the attenuation.
Google Summer of Code 2012 Student
Topic: "Volume Rendering with LOD aimed at terrain"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Mattan Furst
Volume GFX, accepting donations.
Topic: "Volume Rendering with LOD aimed at terrain"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Mattan Furst
Volume GFX, accepting donations.
-
- Gnoblar
- Posts: 5
- Joined: Sat Jun 08, 2013 7:08 am
- Location: Russia
Re: Questions about the light
However, the damping does not work with the application of this material
- Kojack
- OGRE Moderator
- Posts: 7157
- Joined: Sun Jan 25, 2004 7:35 am
- Location: Brisbane, Australia
- x 534
Re: Questions about the light
The shader you are using from the wiki has no support for attenuation. When using shaders, the entire lighting system must be written in the shader, ogre has no control over it (all it can do is make the values like attenuation available, it can't perform the actual calculation).
You'll need a more complex lighting shader like http://www.ogre3d.org/tikiwiki/tiki-ind ... he+Monster
To make lights not go through walls, you'll need to enable shadows.
You'll need a more complex lighting shader like http://www.ogre3d.org/tikiwiki/tiki-ind ... he+Monster
To make lights not go through walls, you'll need to enable shadows.
-
- Google Summer of Code Student
- Posts: 550
- Joined: Thu Jun 04, 2009 5:07 pm
- Location: Berlin
- x 108
Re: Questions about the light
Yes, it's not included in the shader there, but that's easy. You use the parameter "light_attenuation" from here:
http://www.ogre3d.org/docs/manual/manua ... d_005fauto
Set it in your pixelshader .program:
Get it in your shader (CG example):
And use it:
Those snippets are taken from the volume terrain example shaders.
http://www.ogre3d.org/docs/manual/manua ... d_005fauto
Set it in your pixelshader .program:
Code: Select all
param_named_auto lightAttenuation0 light_attenuation 0
Code: Select all
uniform float4 lightAttenuation0,
Code: Select all
float attenuation = 1;
if (lightPosition.w != 0) {
float distance = length(lightPosition.xyz - position);
attenuation = 1.0 / (lightAttenuation.y + lightAttenuation.z * distance + lightAttenuation.w * distance * distance);
}
lightColor = attenuation * otherLightStuff;
Google Summer of Code 2012 Student
Topic: "Volume Rendering with LOD aimed at terrain"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Mattan Furst
Volume GFX, accepting donations.
Topic: "Volume Rendering with LOD aimed at terrain"
Project links: Project thread, WIKI page, Code fork for the project
Mentor: Mattan Furst
Volume GFX, accepting donations.