Jump to content

  • Log In with Google      Sign In   
  • Create Account

Dave

Member Since 22 Mar 2004
Offline Last Active Yesterday, 04:31 PM

Posts I've Made

In Topic: I need some help...

22 June 2016 - 06:13 AM

We were taught C and university before C++. If you're interested in C++ i'd start with a bit of C to get used to the general syntax without complicating it with object orient programming. It would still probably be better for you to stick with Python for a bit since you've started. C and C++ are probably not regarded as beginner languages however it is where i started and i came out ok!


In Topic: when do you load new shaders?

06 June 2016 - 08:59 AM

Thank you! This suggests that a render loop should be based on the shaders first. Although a shader is a property of a mesh you should think about it in terms of meshes being a list associated with the shader, like this:

 

foreach (shader s in ListOfShaders) {

  

     s.SetAsCurrentShader();

 

     foreach (Mesh m in s.ListOfMeshes) {

             m.Draw();

     }

 

}

 

There's generally no correct answer for this as it depends largely what you're rendering to begin with but a good approach is to consider the shader change as something you want to do as little as you can get away with. I suggest that you think of it as each mesh having a material and that you bucket sort the meshes based on the material definition. Part of the material is the shader and then maybe other settings like textures and other render states and blend modes. You generally want to sort by the most expensive variable first, to the least. You're on the right track!

 

I would also suggest that bucket sorting by shader (as you describe) would be suitable enough for the time being and that it's only really worth sorting based on other factors when you're trying to eek out more performance. At this point you'd also be trying to reduce duplicate state setting etc. As always when it comes to optimising this stuff you need some benchmarking first. RenderDoc can provide you with a breakdown of your frame and approximate costs of the draw calls. You can also look at https://mynameismjp.wordpress.com/2011/10/13/profiling-in-dx11-with-queries/ for a more accurate way of measuring blocks of gpu work.

 

Hope that helps,


In Topic: when do you load new shaders?

06 June 2016 - 01:04 AM

Yep thats basically it.

 

The cost of switching shaders like this is generally non-free so be wary of doing thousands of shader switches per frame. It's best to batch them, for example.


In Topic: How to implement Cascaded Shadow Map technique ( simply )?

24 May 2016 - 02:35 AM

Have you implemented basic shadow mapping yet?


In Topic: A Brain Dump of What I Worked on for Uncharted 4

11 May 2016 - 03:18 AM

That's very cool, cheers for sharing. Are you allowed to share information on the tech used? I'm curious to know about what language(s) and framework(s) were used for the level editor and so on.


PARTNERS