PerPixelLighting tutorial
PerPixelLighting tutorial
Hello.
I have one simple and "noobish" question.
What code exactly turns on per-pixel lighting on the room in PerPixelLighting tutorial?
I have one simple and "noobish" question.
What code exactly turns on per-pixel lighting on the room in PerPixelLighting tutorial?
-
- Posts: 131
- Joined: Fri Jun 03, 2005 7:26 pm
when you swap the regular mesh and use the create tangent mesh and and select EMT_NORMAL_MAP_SOLID, it uses a per pixel bump shader built into the engine, whoch is only good if you dont move the object.
"Held in Your arms but too far from my heart." "These thoughts will carry me through the darkest nights...while your eyes rest in mine."
"How quickly I forget that this is meaningless."
"How quickly I forget that this is meaningless."
-
- Posts: 131
- Joined: Fri Jun 03, 2005 7:26 pm
no its gourad shading based on vertex normals and it shades the texture on a per triangle basis
do you have a light in the scene?
lets see some code.
do you have a light in the scene?
lets see some code.
"Held in Your arms but too far from my heart." "These thoughts will carry me through the darkest nights...while your eyes rest in mine."
"How quickly I forget that this is meaningless."
"How quickly I forget that this is meaningless."
Well ... I made very BIG mistake. I think that I have only 2 verticles on the side of the box, but I had 40 (I forgot about it, because I made this model 2 months ago), so I made "fake per-pixel lighting" myself.
So, maybe I am absolutely wrong, but doesn`t per-pixel lighting mean similar effect to this? (when I increase vertex count, the vertex-based lighting looks more "detailed") If yes then why is now (when I created "right" model - only 2 verticles on every side- and then I run perpixeltutorial with this model) perpixel tutorial still shaded with vertex-lighting (no matter if I choose EMT_NORMAL_MAP_SOLID or EMT_SOLID).
Here is the picture:
1 - This is perpixeltutorial with 2 verticles on every side of the box (and with per-pixel lighting)
2 - This is perpixeltutorial with 900 verticles on every side of the box
I think that per-pixel lighting have to simulate "detailed" lighting using shaders to count color for each pixel, which depends on it`s distance from the light source - If this is true, then why it looks same as vertex-based lighting?
So, maybe I am absolutely wrong, but doesn`t per-pixel lighting mean similar effect to this? (when I increase vertex count, the vertex-based lighting looks more "detailed") If yes then why is now (when I created "right" model - only 2 verticles on every side- and then I run perpixeltutorial with this model) perpixel tutorial still shaded with vertex-lighting (no matter if I choose EMT_NORMAL_MAP_SOLID or EMT_SOLID).
Here is the picture:
1 - This is perpixeltutorial with 2 verticles on every side of the box (and with per-pixel lighting)
2 - This is perpixeltutorial with 900 verticles on every side of the box
I think that per-pixel lighting have to simulate "detailed" lighting using shaders to count color for each pixel, which depends on it`s distance from the light source - If this is true, then why it looks same as vertex-based lighting?
Last edited by Prott on Sat Jan 27, 2007 7:09 pm, edited 1 time in total.
-
- Posts: 131
- Joined: Fri Jun 03, 2005 7:26 pm
if there both set on parralax mapping they both are going to look the same, but the more verts you have the more realistic lighting will be acheived.
"Held in Your arms but too far from my heart." "These thoughts will carry me through the darkest nights...while your eyes rest in mine."
"How quickly I forget that this is meaningless."
"How quickly I forget that this is meaningless."
But isn`t "realistic lighting" a work for per-pixel lighting (shaders) to do ?xtheagonyscenex wrote:if there both set on parralax mapping they both are going to look the same, but the more verts you have the more realistic lighting will be acheived.
When each pixel is shaded on pixel-bases, the quality of the lighting doesn`t depends on vertex count.
-
- Posts: 131
- Joined: Fri Jun 03, 2005 7:26 pm
yes it does cuz the light hit a vertex and with a "bump" shader it transforms the texture coords and vertex normal direction to appear to be bump out eg if you have a wall with 4 verts and a light on each side bothe sides would be equally bumped but the center wouldnt any vertnormals so it would have to bring the outside normals slightly in to make the center bumped yet if you have more verts the more normals you have to displace to acheive more realistic "shaders" but lower poly is better but you stil need enough normals to get look. if you have a specular shader on a cube the whole side facing the light would be shiny yet if was subdivided it make only sections of the cube "face" reflect based on the light direction.
"Held in Your arms but too far from my heart." "These thoughts will carry me through the darkest nights...while your eyes rest in mine."
"How quickly I forget that this is meaningless."
"How quickly I forget that this is meaningless."
-
- Posts: 131
- Joined: Fri Jun 03, 2005 7:26 pm