I am working on an independent game project for months and I am almost done with "technical part" of coding (terrain engine, lighting technique, animations) that will be use as construction set for the game.
I am using VB.net, DirectX 9 Managed and HLSL. I have a question regarding the global rendering technique. For now I am only rendering the terrain, water, skybox and sun of an outdoor scene. Soon I will add more meshes. My current rendering program is running like that and use only 1 HLSL effect file including 1 single technique and 4 passes (one for each item of the scene, terrain, water, skybox and sun) :
- Device set appropriate render target
- Clear Device
- Device Begin scene
- [color=#0000FF]Update Effect file parameters
- [color=#0000FF]Effect Begin
- [color=#0000FF]For each pass in the effect file display the corresponding meshes: Pass 1: Terrain, Pass2: Water, Pass3: Skybox, Pass4: Sun
- [color=#0000FF]For each pass in the effect file display the corresponding meshes: Pass 1: Terrain, Pass2: Water, Pass3: Skybox, Pass4: Sun
- [color=#0000FF]Update Effect file parameters
Is it suppose to work this way ? Or is it more like each different material is isolated in an effect file with one or several techniques and you render the loop for each corresponding mesh like :
- [color=#0000FF]Effect 1 Begin / Display Terrain / Effect 1 End
- [color=#0000FF]Effect 2 Begin / Display Water / Effect 2 End
- etc
I believe that it could be heavier for the program to run this way because of common parameters between effect files and the memory load to change of effect file instead of 1 "master" effect file, but I am not sure.
Thank you for your thoughts ! It will be really helpful if someone as the answer to that.