Jump to content
The Dark Mod Forums

Making models treat lights as ambient?


Springheel

Recommended Posts

I'm trying to achieve an effect and I'm hoping someone might know a way to do it.

 

Say I have a model of a sphere. If the sphere is being hit by a light from one side, the bright side will be bright and the dark side will be black (or whatever the default ambient is).

 

What I'd like to do is have ALL sides be equally bright when hit by light.

 

I don't want the sphere to glow in the dark, however. So I can't use an additive blend material. I want it to be lit only when there are lights nearby, but I want ALL of it be lit, not just the side facing the light. Essentially, I'd like the sphere to behave as though it is being hit by an ambient light.

 

Noselfshadow won't achieve this affect...additive blends won't...anybody know of a way to do it?

Link to comment
Share on other sites

Any lights. I want the model to react to lights normally, except that even surfaces facing away from the light are lit.

Link to comment
Share on other sites

Maybe by using a second "lit" model, and applying a light response one the first one. If the first one get's hit by light, the second one will be spawned to replace the first one. If the light is going down/out, you replace it back to the first "unlit" model.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Though there is a STIM_LIGHT stim, none of our lights use it. So even if the entity was set up to respond to it, it would never get tickled.

 

A script would have to keep track of the entity's illumination level each frame and swap the lit skin in and out when necessary.

 

However, I don't think there's a way for a script to query an object's illumination level. We would have to add that.

Link to comment
Share on other sites

My initial thought is also use a stim_light to trigger skin changes, and if it's true that none of our lights use it, then just make custom lights that do use it and package them with your FM. Or if that's very difficult, there are more or less hacky things that might do a similar job, depending on how accurate it is & the difficulty, like even just a proximity stim on the lights (when they're on) set to falloff the same way the light does to the same radius & maybe use tricks to keep it out of shadows. Or think of some other variation with the S/R system.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

@Spring, is this for a 1.08 mission or a 2.00 mission? We can add the entity illumination script request in 2.00, and that should give you all the tools you need to make this happen.

 

Will the entity simply change from unlit to lit and back, or are you wanting a gradation of "lit" depending on how much light falls on the entity?

Link to comment
Share on other sites

I guess I should be more specific.

 

I'm trying to create AI hair out of polygon strips. What's happening is that the outside of the hair, being hit by the light, looks good. But the inside of the hair, which isn't hit directly by light, is nearly black (see image below). This looks especially bad with light-coloured hair, like the nobleman.

 

I tried to fix it by adding a slight additive blend to take the edge off the dark side, but this has the side effect of making the hair appear to glow in the dark, which I don't want (see image 2).

 

What I was hoping for is some kind of material shader solution that would allow the material to react to light as if it were ambient light, rather than directional.

post-9-0-85044400-1367617401.jpg

post-9-0-69620500-1367617533_thumb.jpg

Link to comment
Share on other sites

That only works on twosided materials, and md5meshes can't be twosided. It wouldn't work in this case anyway, since the hair is not a single plane--it has volume, which is why I used a sphere analogy in the beginning.

Link to comment
Share on other sites

In case it's still not clear what I want to do, look at the two images below. The left hand one is lit by an ambient light, and the right a regular light. In the regular light, the right hand side of the pot is black. That's what's happening to the hair. I'd like it to stay evenly lit all the way around, like the pot on the left.

post-9-0-33963400-1367625004_thumb.jpg

Link to comment
Share on other sites

Apparently md5 doesn't support "two sided" so that wouldn't work unless you def attached a static model as the hair

 

Edit: ninja-ed

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

I wonder if you could hack it a bit by having the material register the ambient light bumped up by a few factors. There would still be the differential, but that would at least ensure the inside wasn't black but lit by a bumped up ambient that also doesn't look bad in darkness, and that might be good enough to stop it looking bad in this way.

 

Edit: By the way, all this is making the case for some simple system of ambient occlusion generally (or radiosity, whichever system distributes light over objects) so some light would naturally be spread across all the surface of objects and you don't get the total-pitch-black artifact which always looks odd & unnatural, not just this case. I recall rumors of people playing with something like that, but I don't know what came of it.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

It doesn't go completely black, but it goes nearly black, which is essentially the same thing when the other side is white.

Link to comment
Share on other sites

The world ambient isn't preventing the hair from going completely black?

 

That's what I was trying to say. It might be ok if the world ambient were high enough. So if it behaved as if there were a higher world ambient (hacked in the shader or code somehow) that might fix it well enough.

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

Wouldn't that basically act like an additive blend? If it's brighter than the world ambient, then it's going to look like it's glowing if there are no other lights. The key is that it needs to be unlit when there are no lights.

Link to comment
Share on other sites

I thought of one other method. Use "spectrum" lights. You'll need to include a spectrum light in every light entity that only affects hair materials. Your hair material would need spectrum specific stages. I'll find the doom3world thread

 

Edit: link

 

http://www.doom3world.org/phpbb2/viewtopic.php?t=13802

 


http://www.doom3world.org/phpbb2/viewtopic.php?t=13802

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

The issue isn't two sided polygons. You can always skirt around that by creating the back facing polygons manually. The real issue is that the md5 format does not support vertex colors and they are a prerequisite for vertex blending.

 

Spectrum lights wouldn't help here. You'd double the light count and and then you still have to solve the blending issue.

 

The proper solution here is the ability to specify a custom light interaction shader on a per material basis. This would be useful for vegetation as well since it's the same issue.

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

      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
    • 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
×
×
  • Create New...