Download

After receiving some feedback from Epic i'm posting updates here for guidance.

Hi,

So a very long story short and after yet another recent post:

I’ve been trying to achieve a “Modulated Decal”, or wait, forget Decals lets just call it ANY projection that is “Dark” in unlit scenes inside UE4 since forever, (also using Forward rendering but shouldn’t really matter). I found out that I simply can’t get there and after submitting a report to Epic regarding the decals not giving the results i need, I receive the following feedback:

"BasePassPixelShader.usf is where the material fetches the decal information from the DBuffer. However since this material is unlit directly lighting does not get computed regardless of if in forward or deferred shading. So any material property you are trying to change with the decal wont have any effect. "

After which they advised me to post and follow up in the forums so here I am.

From what I gather from this info is that it’s either A) not implemented or possible inside the current state of UE4 B) it’s simply not possible for reasons given above, but doesn’t this bring us all back to point A especially having worked it in Unity below.

My endless problematic cycle was that it must be an engine limitation and not a rendering logic thing if I could work it in Unity. I just want to know how to proceed.

So coming from Unity3d I was able to get the effect I need in an unlit scene in forward on top of an unlit material and a fully projected dark texture and below is a demonstration of that:

gif.gif

I think I asked this question for so long and I either got answers like “Its a bug” or answers about rendering as the one from Epic.
So what to do next? Do i need to hire a veteran graphics programmer to code something for me do i need to tweak the source? Is there even a certain guarantee that it would work?

I found many Answerhubs gone unanswered for similar topics or pointed entirely the wrong direction.

So this is my last effort here before I go on my own and find answers outside the community.

Thanks in advance.

You are really over-complicating things. Just use translucent unlit material with modulate blend mode.

Why? I am already using that method you suggested, but i’ve given clear reasons why its not a good way of approaching it, I will repeat them here again:

1 - I can’t have it “Projected onto uneven surfaces” this is important for me.

2 - It creates intersections.

3 - It creates perspective issues.

4 - long unnecessary setup times!

It’s simple, It works in Unity so my processing says it should work here, if it doesn’t then its an engine issue and Epic needs to be aware that there are devs out there that really need this feature. If this feature cannot be provided for whatever reason then it is important for said devs to understand why and how to implement it.

Frankly, none of your posts are clear or give a firm understanding of the effect you are after. You went from ambient occlusion to modulated black spots in like several posts.

Why not? What stops you from projecting it?

I have no idea what would that be.

Not seeing anything problematic here. Replacing decal actor with static mesh actor is all what it takes.

Again, you are not defining what is “this feature”. As long as you come up with a meaningful explanation of it, you will get more meaningful answer.

First I appreciate you taking thew time to answer me here so thanks for that maybe I can come to a conclusion with your help:

I don’t know how much more clear I can be when I am showing the exact effect I want to achieve but done in Unity. And I’m not speaking of just a blob I’m speaking of the ability to add a projected texture. the blob is just a test texture.

Most likely you are more knowledgeable than me when it comes to the engine. Are you saying that you could get the same exact projection similar to the one I showed done in Unity using materials and a static mesh?

I mean I tried many things, perhaps there is a depth calculation i may be missing in the material that enables the projection to take place correctly? Is there a screenshot you can show me that could help?

So far all I could achieve is a static mesh with modulated texture applied to it, there is no projection not anything going on. That’s the reason why I keep posting.

From the way you replied I’m beginning to feel that i’'m really missing that one point that keeps leading me down into this rabbit hole.

On a large scale, there is not much difference between static mesh cube and decal actor. You can project the texture using default cube mesh with something like this:http://prntscr.com/o64gpm
You will need to solve certain additional tasks, as to making sure that the effect works also when camera is inside projection box, will be lacking certain features that decal actor has as well as paying a bit more performance cost.

Extending stock decal actor to allow blending color directly over scene color will need an engine change and yes, you can get an engine programmer to perform that.

You could try and use WorldPositionBehindTranslucency on a translucent unlit material.
The material I’ve set up will project an unlit black spot on an unlit white surface like the top video :slight_smile:
I’ve applied it to a cube and placed it near an unlit surface. I suspect with some further work you should be able to project a texture as well.

Thanks to both of you, I understood how it now works, The key was having the world position behind translucency node which I was missing. This obviously comes with certain limitations I can’t have it skew the texture since it is only projecting on one Axis in my case Z. While i’m able to play with Offset/Rotation and size of the texture, it wont given me the flexibility so far of skewing the texture as in my original example.

I also added scaling SphereMasks non_uniformly for added control. So this way AO effects are also simulated better (this ties in to my other posts @Deathrey )

But I can live with this for now it is much better than what i had before.

The thing is that even while showing examples before like I did here, people had a hard time figuring out an answer for me. when it was at least somewhat as simple as what you provided. It is not the perfect setup but at least it’s something. This should help those who were seeking an answer to this as well.

So thanks again for your time in helping out.

But I still stand with my note to Epic that Decals or something similar to them should have the ability by default in engine to do this! Decals have the ability to project and skew texture as well as do all the other things that would make it a proper projector. It is too bad we don’t have this by default which leads us down these unnecessary workarounds and setups for scenarios like these. That’s what bugged me in the first place, especially when transitioning from Unity to UE4.

That is still off. Applicable to how it looks, there is no feature a decal actor has, that you can’t replicate in translucent material.

I managed to Skew the texture while at the same time off seting it so its always centered at the pivot. Its a workaround but it works. Thanks

Hate to bring this up again, but after getting most of the features working more or less the way i needed them, I came back to a vital problem, which is that in a typical “Decal” situation you have the ability to tell objects “not to receive decal” projection, but if we are doing this manually via material as in here, how am i supposed to tell objects in the scene to not receive said material effect?

any ideas?

Something like render objects, that are supposed/not supposed to receive decals into custom depth buffer, and in decal material check if receiving pixel depth is greater than the one stored in custom depth and out 0/1 opacity respectively.

Thanks man I appreciate you keep looking into this problem with me and bailing me out, I will try to figure out what you said, in case you find the time it will be great if you could provide a quick sample that would make it much clearer for me!

This is not correct. One example is an opaque or semi-opaque decal that receives lighting and shadow; a translucent material will only be able to use one of the translucency lighting modes. Those modes are more limited than lighting model used with the opaque blending mode.

OK so I created a custom depth buffer for one of my objects in the scene that the projection supposed to go on it ion order to exclude it form the projection for a test.

I set the value of the stencil to 1 . I went back into the projector decal material I created and now I want to extract the stencil so i can “Mask out” the respective object in the scene (I guess this is what you meant), but for some reason i can’t get the mask or stencil to show up at all in the material, I plugged it directly into the mat just to test it and nothing but black comes up. Its as if it doesn’t “see” the stencil in the custom depth node.

Meanwhile I checked in the view editor through buffer visualization and the custom buffer stencil I put seems to be there and working, only it doesn’t show up in my material scene texture node setup below. (I have stencils enabled in the project settings and all).

I think you want to use the “Custom Stencil” scene texture rather than custom depth. The attached setup is working for me:

Ok. My issue turned out to be that while I had checked “stencils enabled” in the project settings, I failed to notice that I had to also check “Enabled with stencils” in that drop down menu from the same list. I assumed the enabled stencils would automatically do this already!

Man sometimes these settings are all over the place. If it says in the settings “Custom depth - Stencil pass = enabled” logically I assume its creating custom depth + Stencil pass. Why do I have to check “Enabled with stencils” again from the drop down menu.

Perhaps it would’ve been less confusing if it was another checkbox and not a drop down list.

Thanks though.

Edit: Nevermind solved it