Jump to content
The Dark Mod Forums

Light Gem approaches


nbohr1more

Recommended Posts

Me:

 

Doesn't the current method sample some screen-shots and evaluate them on the CPU?

 

If so, then being able to abstract that out to a simplified mathematical model would definitely be a boost.

 

I always thought that "in the future" the renderer would be freed to be 99% GPU driven work while you could keep some of the CPU based light evaluation mechanics as part of your Light Gem calculation. unsure.gif

 

You could probably cover the outlier lighting properties right now with encoded spawnargs for the light entities.

 

Basically make a tool that takes the size and shape of the light volume and calculates how the light textures will fill it then cuts the data into a low resolution volumetric grid. You could then use that data like any other table structure that can be accessed via SDK\Script. You would create a spawnarg that could call that table at run-time. For moving lights you would perform matrix translations based on the movement. So the key would be to have Dark Radiant pre-process all these lights into their simplified light-grid volumes. Actually you could be even more clever and have prebaked templates for a standard volume size then just translate the values to the volume size at run-time too.

 

If only I knew how to code it... rolleyes.gif

 

New Horizon:

 

smile.gif That Would all likely be overkill.

 

The current light gem system takes alternating top and bottom snapshots of a white, diamond shaped object. I believe the snapshots are only 32 x 32 pixels. Each snap shot has 4 sides...and the light value is averaged between the two shots. The original lightgem system simply runs a trace to the lights from alternating points at the player position. Our original system is how they did it in Thief 1,2, and 3. Unfortunately, we didn't have deep enough access to the renderer to be able to read all types of shadow.

 

If either the current system could be further streamlined...or the old system brought across the finish line, it could provide a nice performance boost to the low enders.

 

 

Me:

 

Right... but those simple samples that are taken come from slices of the light volume.

 

Inside the Doom 3 engine, the whole light volume is tracked of course and it's intersection with objects get entries in the Interaction Table but Doom 3 doesn't really "know" how the volume is filled because that is done on the GPU via texture translation and shader operations. Tracing to lights won't work for animated textures or variable lightFalloff Images because the "real" shape of the light will not be preserved only the cube that represents it's radius (etc). Simplifying the volumes into low resolution 3D grids (blocks) would retain a great deal of the precision without needing to do a feedback loop to the CPU to examine pixels (which is bogged-down due to inefficiencies in reverse traffic from the GPU).

 

I still believe a simple array look-up will be faster than capturing those pixels and sending them back to the CPU.

 

Actually, since the Light Volumes are really 1D+2D you could just have simplified arrays that represent each texture type (2D Projection vs 1D Falloff) but I am really hoping for 3D texture support for lights so that would be a future-proofed method.

 

Of course, source code access will be great for inheriting dynamic shadow locations without having to let the engine paint them first (etc).

 

Edit

 

The down-sides:

 

Animating textures would need to be synched with array translations for the simplified grid-cube. (not too bad because the materials for animating textures often already have translation time factors in them...)

 

Developing the pre-processor that makes the grid-cubes. :unsure: ... Pretty big undertaking...

 

 

Does this look like a good way forward for the future?

 

Should I tracker this concept?

Edited by nbohr1more

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

If the sample tiles are captured during their portion of the render rather than "after a frame has completed" that goal seems reasonable.

 

Actually, the more I think about it... If a totally GPU based shadow generation system is in-place (after GPL release), capturing the render or part of the render might be the only practical solution. I don't think you could simplify the shadow volume projection the way you could the light volume content. I guess you could make a hybrid system where a GPU based shadow is rendered in the distance but a CPU calculated volume is rendered when the player is near...

 

Maybe like?

 

LOD 3 = No shadow

LOD 2 = Low resolution shadow map

LOD 1 = GPU Stencil Shadow volume

LOD 0 = CPU Stencil Shadow volume

 

:unsure:

Edited by nbohr1more

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

Not sure if I understand this correct, but do you want the light gem to be replaced with a mathematical model? If yes, there are several problems involved, so that's why I took the rendering approach.

 

If the source is available, then this problem might be more easily resolved because I think that Doom already does this caluculations anyway, as the player model is also shadowed accordingly. So if the complete source is available it might be as easy as hooking into the appropriate code getting the lightgem for free.

Gerhard

Link to comment
Share on other sites

Well...

 

Yes and No.

 

My idea was to make a simplified low resolution Voxel renderer in the SDK that renders only the light volume data. Your voxels would have X, Y, Z offset from the light origin and a brightness level. So it's not purely a mathematical distance-based falloff function but instead can include animation and non-linear variation just like the real renderer but scaled-down to very low resolution (and only including lights). The "yes" part is if you have to calculate the dynamic shadow locations from scratch... I thought there was an SDK way to collect the shadow calculation result before it renders though :unsure:

 

If all the lighting calculations move to the GPU in the future, this is about as simple as I could imagine for the AI framework to realistically track lighting without having to sample the render.

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

The "yes" part is if you have to calculate the dynamic shadow locations from scratch...

 

Well, this is very hard, because of the flexible way of how Doom 3 can setup lights. Basically you have to do the same as the renderer does anyway, and then you haven't even included the scripting and animation, which also can affect lights. I tried this approach in the beginning, but when I realized how big and futile a task this is, I aboondoned that idea.

 

I thought there was an SDK way to collect the shadow calculation result before it renders though :unsure:

 

Well, if there were, we would have used it. ;)

Gerhard

Link to comment
Share on other sites

Thanks.

 

I was confused and thought that your math-based lightgem had a shadow calculation method and the problem was more about the simplicity of the light representation itself.

 

Just out of curiosity, did you ever try:

 

1) Compile the Shadow algorithm source code from Id's Intel SSE document http://software.intel.com/file/37730

2) De-compile and capture the pattern

3) De-compile the Doom 3 executable

4) Find the matching pattern from 2

5) Develop an inline injection to replace that code with one that has a virtual handle (etc)

 

?

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

1) Compile the Shadow algorithm source code from Id's Intel SSE document http://software.intel.com/file/37730

 

Nope. Never heard about that.

 

2) De-compile and capture the pattern

 

Nope.

 

3) De-compile the Doom 3 executable

 

Yes.

 

4) Find the matching pattern from 2

 

Nope. :)

 

5) Develop an inline injection to replace that code with one that has a virtual handle (etc)

 

That would have been a logical consequence of 2, if that would have yielded something usefull. I only decompiled D3 though, because I often do that with apps, just to snoop around. Reverse engineering the render engine would be a long and tedious job.

Gerhard

Link to comment
Share on other sites

Thanks again. I love getting this kinda feedback :wub: .

 

If you like that document and are interested in other similar ones from Id, check out the pdf links at the bottom of this article:

 

http://software.intel.com/en-us/articles/optimizing-the-rendering-pipeline-of-animated-models-using-the-intel-streaming-simd-extensions/

 

I know you said you're rusty at C++ but I hope to see your name in Bug Tracker after Doom 3 goes GPL (eventually) :)

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

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

    • 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
       
      · 1 reply
    • 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
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
×
×
  • Create New...