x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Creating a light which only creates shadows

Hello!

What I want - is to be able to create some kind of "light" component, which will not generate light, but only shadows. It should be able to "shadow" already existing lights and shadows (basically after all calculation of shadow and lights, some kind of postprocessing them), shadowing all that is not "lit" by this "invisible light".

It seems that I need to go inside the rendering, but I just don't get how and where. Can someone give me an advice what should be known to do such a thing, which classes I should investigate, and maybe there is even a some kind of API for that?

Thanks in advance!

Product Version: Not Selected
Tags:
more ▼

asked Apr 02 '14 at 09:13 PM in C++ Programming

avatar image

Evengard
51 6 10 170

avatar image Evengard Apr 03 '14 at 08:31 PM

At least can someone explain the rendering of lights? At least - which methods are being called for their rendering each frame in which direction. Because I see the associated functions (like AddLight, ModifyLight, their rendering counterparts, etc), but I am lost about their call order.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

4 answers: sort voted first

Regular shadows are not actually drawn, they are the absence of light from a particular light casting object. I think you are thinking of lights as drawing both the light and the shadow as two different components, and you wish to simply not draw the light one. This will not work.

I think you should move away from lights in the regular sense and look for information on how to project an image onto the world. Lights using light functions and decals use this in one way or another.

What you want to do is capture an image of what this invisible light hits, color all that black/grey and project this black image to pixels that are behind the ones in the projected image.

more ▼

answered Apr 04 '14 at 08:19 AM

avatar image

Dieselhead
1.2k 27 22 210

avatar image Evengard Apr 04 '14 at 10:47 AM

Well, probably you are completely right! But I just can't get how to do that. Can you guide me on some UE APIs on how to do that?

avatar image Evengard Apr 04 '14 at 10:56 AM

And I don't understand what functions like FDeferredShadingSceneRenderer::CreatePerObjectProjectedShadow etc are actually doing?

avatar image Evengard Apr 04 '14 at 11:17 AM

By the way looking at the code - are lights unrendered when you don't have DX10 at least? Requiring Shader Model 4 for that?

avatar image Evengard Apr 04 '14 at 04:21 PM

Noone can help me? :( There is a little about the actual renderer in documentation...

avatar image Evengard Apr 04 '14 at 05:07 PM

As far as I understood - i need to create an attenuation buffer, but apply it not to the light, but to the whole scene, and do not render the light... Am I right?

avatar image Evengard Apr 04 '14 at 05:44 PM

Actually the shadow seems to be present in the attenuation buffer, which is then applied wher rendering the light. But well I don't get how it gets transformed into the ColorBuffer of the light, and how to override to go straight into the ColorBuffer of the scene itself... Seems like it is doing that by some means of shaders...

avatar image Dieselhead Apr 04 '14 at 05:52 PM

I wish I could help you more but all I can say is that traditionally lights that cast shadows draw a depth map from their point of view to map the surfaces that are closest to them. These are the surfaces that will be lit. Later on when the lighting is applied to the scene that is rendered from the players point of view, pixels in this view will be compared to the values in the lights depth map. If the depth greater then the value in the map, that means the pixel is behind a surface in the lights view. That means it should not recieve light and will be shadowed.

Now this is generally speaking and there are other ways to create shadow effects, I don't know for sure what implementation UE4 uses and being a state of the art engine it's quite possible it's using more advanced techniques that I am not aware of. So feel free to take my advice with a grain of salt :)

avatar image Evengard Apr 04 '14 at 05:59 PM

If only one of the UE4 devs could help me... :) Thank you a lot, but I am completely lost now :(

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hey Evengard,

Check out this Archive post about Negative Lighting: https://answers.unrealengine.com/questions/10390/requestnegative-lights.html

Hope that helps!

Ben Halliday

more ▼

answered Apr 02 '14 at 09:36 PM

avatar image Evengard Apr 02 '14 at 10:17 PM

Hello!

Unfortunately this is not what I need (I saw that already). This is "substractive light" while I need "substractive shadows" which doesn't affect the non shadowed lights. I hope I explain it clearly enough :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I don't really understand what you want, is it shadows like ghosts in metro 2033 ? you know... :

http://cloud-2.steampowered.com/ugc/486694762777401332/FA2BE0FA38A54371E7C55F7BC69FE392B31F42FD/2048x1152.resizedimage

http://cloud-2.steampowered.com/ugc/486694762777403566/1497E4E3D456A28F7511B66137A569F66C4B15B5/2048x1152.resizedimage

Edit : silly me, this ain't shadows at all, just black transluent models shown by the flashlight...

more ▼

answered Apr 04 '14 at 07:17 AM

avatar image

Deu_sex
116 7 24 18

avatar image Evengard Apr 04 '14 at 10:45 AM

Yeah, totally different. :)

avatar image Evengard Apr 04 '14 at 12:19 PM

More like a fog of war in strategies - but more realistic and applied to a person viewpoint.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

A dirty way of doing it would be to add the shadows to the texture. You could render to texture in 3ds Max. That would require a complete scene to be done in 3ds Max, then exported.

more ▼

answered Apr 04 '14 at 06:49 PM

avatar image

ChristopherPC64
718 27 20 41

avatar image Evengard Apr 04 '14 at 08:32 PM

Nope, definitely not a solution. I need to recalculate it dynamically at each frame - this "light" will be bound to the character. Actually I need all of that to hide from the player the things his character can't see (i am using a top down camera). Some kind of "fog of war".

avatar image ChristopherPC64 Apr 04 '14 at 10:37 PM

Definitely not a solution for that.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question