Jump to content
The Dark Mod Forums

Render Mode Is Broken [open]


Recommended Posts

Progress update: Preliminary investigation showed that the GLProgram pointer was NULL in Renderables_Flush(), so that the shaders were not even being used. I am currently in the middle of refactoring some of the renderstate code, so that this problem can be more easily examined -- which is unfortunately a rather difficult task as this render code is some of the worst I have ever seen by way of interdependency and entanglement (class methods which call C functions which set global static variables which are used by other class methods on a different class...).

Link to comment
Share on other sites

Sounds like fun. :) I was once working on a project which was equally strange. The C code dynamically created (even nested) DOS batchfiles, which in turn was calling the application again with different parameters in order to trigger some function. And all written in a very "creative" way. It was a nightmare to debug.

Gerhard

Link to comment
Share on other sites

I have a feeling the GLProgram is set from the material, so if the material parsing is broken it might not select a correct program.

 

Next up: move the GLPrograms into a factory class rather than having stupid static globals for each one.

 

Incidentally, I am doing all of this in a separate branch, meaning that I can commit intermediate changes that won't build or work, without breaking the main tree. This is very useful for large or experimental sets of changes, such as refactoring.

Link to comment
Share on other sites

It seems I was wrong - it is not the GLProgram which is set incorrectly, it is the RendererLight. WHen the OpenGLStateBucket is populated with transformed renderables, it seems that the m_light pointer is always 0, leading to a black render.

 

I need to investigate how these lights are populated.

Link to comment
Share on other sites

Further investigation shows that the light is not always NULL, just a lot of the time (which may be correct). After adding an operator<< for RendererLight, I can see that the correct light is being passed through with the correct dimensions and colour.

Link to comment
Share on other sites

Finally, some progress. Observations:

 

1. The attenuation_z parameter should be bound to a texture -- if the light shader does not specify a texture this is looked up from the default lightshader. This is in fact always bound to 0, which may be what is causing the black display.

2. There are TWO defaultlight shaders in the Light Inspector - lights/defaultpointlight and lights/defaultPointLight. The lowercase version comes from the .game file via ShaderCache_Construct() in renderstate.cpp, while the mixed case version seems to be hardcoded in Light_Construct() in the entity plugin. Only the lowercase version shows correctly in the light inspector, which suggests that the existence of the mixed case version (with its blank falloff images) is causing the problem.

3. Changing the name of the mixed-case version in light.cpp shows that this is the one being used, NOT the one populated from the .game file.

Link to comment
Share on other sites

This is now fixed at last. The problem was in the shaders::MapExpression class I added during the (partial) shader plugin refactor, which was failing to process "makeintensity" which is used in a lot of light shaders for the Z falloff image. I have added in a console error that is emitted if a light shader defines an invalid Z falloff, which should pick up this kind of issue in future.

 

Unfortunately however, I think we are going to need to look at the renderer performance sooner than planned -- trying to view mansion_alpha in lighting mode uses up all my memory, takes about 30 seconds to display and then runs at about 1 fps. I will raise a defect for this.

Link to comment
Share on other sites

Congrats! This was kind of tough or at least tiresome I guess. :)

 

Yes, it is difficult to debug render problems because all you have is a black screen, a very large number of possible causes (missing geometry, missing lighting, incorrect culling, bad shaders, bad GL calls, bad textures etc), and no easy way of debugging the process other than adding loads of print statements.

 

Are there any other issues left that have to be resolved before 0.8.0?

 

No, I think this is all we need for 0.8.0, touch wood.

Link to comment
Share on other sites

Namespace is planning to upgrade the renderer, isn't he? I know that the new render system won't be finished tomorrow, but wouldn't it be redundant to look into this if the render is to be reorganised anyway?

Link to comment
Share on other sites

Namespace is planning to upgrade the renderer, isn't he? I know that the new render system won't be finished tomorrow, but wouldn't it be redundant to look into this if the render is to be reorganised anyway?

 

Not necessarily. It might be possible to implement some of his ideas and produce an immediate gain, even before the whole redesign is complete. It would certainly be worth doing some basic profiling to see where the main problems were occuring, for example it could be that the scene graph or culling code is implemented very inefficiently, or certain operations are performed more frequently than necessary. Just getting rid of the 30 second delay when render mode is first activated would be a good step forwards.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 2 replies
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 5 replies
    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 7 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
×
×
  • Create New...