Jump to content
The Dark Mod Forums

Auto Light Volume Resizing Script Challenge (SteveL ?)


nbohr1more

Recommended Posts

Per our discussion:

 

http://forums.thedarkmod.com/topic/16059-pathtarget-testing-script-for-dr/

 

Objective:

 

Create a script that resizes light volumes for specific entities (torches, etc) so that they do not extend outside the rooms that contain

them. This script will also calculate offsets and apply offset spawnargs to the light_center and flame particle (origin) so that the

light and flame still appear to originate from the same absolute location.

 

Possible algorithm:

 

1) Store absolute light_center location

2) radiate vectors from current light origin until opaque textured tris are hit

3) Resize volume cube to one unit beyond the largest radius vector for found tris in the volume (cube)

4) Calculate offset values for light_center and flame particle to relocate them back to the position in step it (using

light origin vs the data in step 1)

 

 

Possible assistance: (as with the other challenge) parse a dmap of the existing map

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

I agree there could be a job for a script somewhere here. I've often wanted to do this to an entity light and have ended up replacing it with separate model, light, and particle. I hadn't realised you could offset the particle. That makes sense but would still be fiddly to do manually.

 

I'm not sure whether it could be so automatic. Imagine doing this in a squarish room with several torches. You'd end up with every torch hitting every surface but without illuminating any walls because of falloff. I'll try out a much less ambitious version to start with, and take it from there. One that moves the particle on an entity light to where the light vertex is, which is something I've wanted to do before now and didn't realise was possible.

 

Edit: just re read it and see you already have overlap covered. The script wouldn't enlarge the volume. What about falloff though?

Edited by SteveL
Link to comment
Share on other sites

Yes, the light volume size has an effect on the brightness so any resizing must also adjust for that.

 

You would need to change the RGB values for the light and possibly even use the texture scale and translate

operations to stretch the projection images. Not an easy task to be sure.

 

This reminds me of my other pie-in-the-sky idea:

 

Somehow, automate the creation of light projection images so that you could do "Strombine":

 

http://www.lunaran.com/page.php?id=165

 

without being a Mensa genius like Lunaran.

 

 

Edit:

 

On consideration, the relation of volume size to falloff is probably purely due to the mechanic of the falloff image itself.

When you stretch the volume, the percentage of the falloff image your area occupies decreases and you are closer

to the center or end of the image. The problem of resizing this is that there is no UV structure like a regular texture

(at least not user editable) so you'll just get a weird shifted result rather than any increase. Hmm, if the falloff were fairly

exponential and even you could just use RGB values on the image itself and as you made it brighter it would occupy

more of the volume. Still a bit of work to rewrite this material defs.

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

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

    • OrbWeaver

      Finally got round to publishing a tutorial on baking normal maps in Blender, since most of the ones we have are inaccessible or years out of date.
      · 0 replies
    • nbohr1more

      The FAQ wiki is almost a proper FAQ now. Probably need to spin-off a bunch of the "remedies" for playing older TDM versions into their own article.
      · 1 reply
    • 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 )
      · 3 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
       
      · 7 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
×
×
  • Create New...