Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualTom KQT

Posted 23 May 2013 - 01:21 AM

EDIT: As Steve_Segreto pointed out, it is possible to combine FFP and vertex shaders when rendering in multiple passes. I didn't know it. And I still cannot imagine how would that work if you want to "use FFP for lights" and "render meshes with shaders", it's probably rather for "render some lights using FFP and some using shaders".

And there are problems with FFP+shader combinations anyway, so it does not invalidate my post too much ;)

 

You want to use the fixed-function pipeline for lights (device->SetLight(), device->LightEnable()), while rendering your meshes with shaders? Sorry but that won't be possible. If you want to use FFP for lighting, you have to use the quite simple FFP materials.

 

You cannot really divide the process into "rendering a mesh" and "lighting the mesh" and use FFP for one of those and shaders for the second. How a mesh sufrace looks when rendered is given by how the light interacts with the material, there's a tight connection. The output of your shader must represent the final look of the mesh, you cannot really say to the FFP something like "here's my material shader, please light it up for me with your lights".

 

In fact you need shaders with all possible combinations of lights and material. There are many ways how to achieve it, from the most flexible (branching using if conditions in the shader) to really having separate shader files (or effect techniques) for every combination. Btw, now I'm talking only about TYPES of lights (directional, point etc.) and materials (textured with diffuse lighting, normal-mapped, light-mapped etc.), details like material and light colors (ambient, diffuse, specular), material texture etc. can be set via shader variables and thus the shader file will of course be the same for a red material and a blue material.


#4Tom KQT

Posted 23 May 2013 - 01:18 AM

EDIT: As Steve_Segreto pointed out, it is possible to combine FFP and vertex shaders when rendering in multiple passes. I didn't know it. But there are problems with that anyway, so it does not invalidate my post too much ;)

 

You want to use the fixed-function pipeline for lights (device->SetLight(), device->LightEnable()), while rendering your meshes with shaders? Sorry but that won't be possible. If you want to use FFP for lighting, you have to use the quite simple FFP materials.

 

You cannot really divide the process into "rendering a mesh" and "lighting the mesh" and use FFP for one of those and shaders for the second. How a mesh sufrace looks when rendered is given by how the light interacts with the material, there's a tight connection. The output of your shader must represent the final look of the mesh, you cannot really say to the FFP something like "here's my material shader, please light it up for me with your lights".

 

In fact you need shaders with all possible combinations of lights and material. There are many ways how to achieve it, from the most flexible (branching using if conditions in the shader) to really having separate shader files (or effect techniques) for every combination. Btw, now I'm talking only about TYPES of lights (directional, point etc.) and materials (textured with diffuse lighting, normal-mapped, light-mapped etc.), details like material and light colors (ambient, diffuse, specular), material texture etc. can be set via shader variables and thus the shader file will of course be the same for a red material and a blue material.


#3Tom KQT

Posted 23 May 2013 - 12:41 AM

You want to use the fixed-function pipeline for lights (device->SetLight(), device->LightEnable()), while rendering your meshes with shaders? Sorry but that won't be possible. If you want to use FFP for lighting, you have to use the quite simple FFP materials.

 

You cannot really divide the process into "rendering a mesh" and "lighting the mesh" and use FFP for one of those and shaders for the second. How a mesh sufrace looks when rendered is given by how the light interacts with the material, there's a tight connection. The output of your shader must represent the final look of the mesh, you cannot really say to the FFP something like "here's my material shader, please light it up for me with your lights".

 

In fact you need shaders with all possible combinations of lights and material. There are many ways how to achieve it, from the most flexible (branching using if conditions in the shader) to really having separate shader files (or effect techniques) for every combination. Btw, now I'm talking only about TYPES of lights (directional, point etc.) and materials (textured with diffuse lighting, normal-mapped, light-mapped etc.), details like material and light colors (ambient, diffuse, specular), material texture etc. can be set via shader variables and thus the shader file will of course be the same for a red material and a blue material.


#2Tom KQT

Posted 23 May 2013 - 12:40 AM

You want to use the fixed-function pipeline for lights (device->SetLight(), device->LightEnable()), while rendering your meshes with shaders? Sorry but that won't be possible. If you want to use FFP for lighting, you have to use the quite simple FFP materials.

 

You cannot really divide the process into "rendering a mesh" and "lighting the mesh" and use FFP for one of those and shaders for the second. How a mesh sufrace looks when rendered is given by how the light interacts with the material, there's a tight connection. The output of your shader must represent the final look of the mesh, you cannot really say to the FFP something like "here's my material shader, please light it up for me with your lights".

 

In fact you need shaders with all possible combinations of light and material. There are many ways how to achieve it, from the most flexible (branching using if conditions in the shader) to really having separate shader files (or effect techniques) for every combination. Btw, now I'm talking only about TYPES of lights (directional, point etc.) and materials (textured with diffuse lighting, normal-mapped, light-mapped etc.), details like material and light colors (ambient, diffuse, specular), material texture etc. can be set via shader variables and thus the shader file will of course be the same for a red material and a blue material.


#1Tom KQT

Posted 23 May 2013 - 12:40 AM

You want to use the fixed-function pipeline for lights (device->SetLight(), device->LightEnable()), while rendering your meshes with shaders? Sorry but that won't be possible. If you want to use FFP for lighting, you have to use the quite simple FFP materials.

 

You cannot really divide the process into "rendering a mesh" and "lighting the mesh" and use FFP for one of those and shaders for the second. How a mesh sufrace looks when rendered is given by how the light interacts with the material, there's a tight connection. The output of your shader must represent the final look of the mesh, you cannot really say to the FFP something like "here's my material shader, please light it up for me with your lights".

 

In fact you need shaders with all possible combinations lights/material. There are many ways how to achieve it, from the most flexible (branching using if conditions in the shader) to really having separate shader files (or effect techniques) for every combination. Btw, now I'm talking only about TYPES of lights (directional, point etc.) and materials (textured with diffuse lighting, normal-mapped, light-mapped etc.), details like material and light colors (ambient, diffuse, specular), material texture etc. can be set via shader variables and thus the shader file will of course be the same for a red material and a blue material.


PARTNERS