A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Assets and Asset Store' started by Llockham-Industries, Jan 12, 2017.
@DDNA - Nice find, managed to recreate, working on a fix now.
@DDNA - Finally managed to track this one down. Thanks for the repro case, made it significantly easier. Essentially the modifiers where not being de-registered as they needed to be enabled to be deregistered, but the deregister call back was being called from onDisable() (ie. they were already disabled). The check made sense for the register callback, but shouldn't have been in place for the deregister callback. This actually caused a lot of performance issues in the goo scene, as fade modifiers would stack indefinitely. pretty big find, thank you!
To fix open Modifiers.cs and change line 62 from -
if (Application.isPlaying && gameObject.activeInHierarchy)
I just bought this and on Mac with OpenGL it works fine. But when i try to build for Windows (DX11 and DX9) build fails with this error:
Shader error in 'Projection/Decal/Specular/Forward': texlod not supported on this target at Assets/Dynamic Decals/Resources/Shaders/Cginc/Projections.cginc(374) (on d3d9)
 Never mind, found solution in previous pages. Forum search/google did not find it because error message were in screenshot
Ok, another problem with Dynamic Decals. Something about them are causing lag on render, even when decals are not visible? Is this from Decals or do i have some other problem?
 I just confirmed that this is somehow related to Decals. When i turn Decals off, the game runs at 60fps. With decals, about 20fps.
Weird part is that decals are not even visible, when they are created (blood splatters) rendertime goes thru the roof.
@teroojala - Could you show me your mask settings in the Dynamic Decals Settings window? I gather your using 2 of the layers, is the layer that contains your terrain apart of both of these?
I'm new to Decals so i have not touched the layers at all. Here is the settings.
@teroojala - The system is essentially a screenspace effect. It uses shader replacement to build a view of the world in buffers, then uses these buffers in the main pass to reconstruct our decals.If there are active decals in the scene they will require this shader replacement, but this cost is independent of the number of decals. This is how we are able to generate and move decals at run-time so quickly, it's all done in the shader. Of course, the downside is you have to pay for the cost of drawing these buffers.
Right now you're doing so three times though. Do you perhaps have multiple cameras? If so do you need to see decals in all of these cameras? Working on more efficient shader replacement options as we speak as well .
Hi, I love the decal system and generally works excellently. However Im running into some odd issues with shadows. It appears that shadows are not being rendered over the top of the decals? Is there a simple fix for this? (I have tried all the decal types with no luck).
Hi~ i'm using dynamic decal in VR environment(HTC Vive).
I loaded your sample VR scene, and blood decal on bottom looks like screenshot.
I applied dynamic decals on my own scene, similar result happened.
How can I solve this problem? Thanks in advance
First time using release 2.x, just updated everything and had some questions about the new version. Noticed a difference with the old version 1.x - not sure if it's a bug or I'm just missing a configuration option somewhere: why are all decals now rendered on top of any alpha-tested shaders (e.g. a tree 50 meters in front of a albedo/normal decal is ignored and decal is rendered on top of it).
Also, it looks like ambient lighting not applied on any decals not in "Force Forward" mode - any shadows are pure black, in contrast with forward mode, which is correctly lit by ambient. This was the same on 1.x after I moved to Unity 2017, though - only Unity 5.6 had correct ambient contribution on your deferred decals. Might be some sneaky shader macro change you'll have to account for.
Im going to start digging into the shader to see if I can get the decal rendered before the shadow pass. Im hoping its just a sort order thing.
Using latest Dynamic Decals in Unity 2017.3.0f1 with Vive, happens in both Single- and Multi-Pass in the demo scene.
It's very visible when moving the controller in front of the eyes, as if the geometry is offset.
I'm also having these problems with VR.
@skom01 @TeemuMevea @tagoth - Sorry about the wait, took a little bit to track down. VR Issues can be fixed by opening DynamicDecals.cs and changing line 111 from :
fireInCulling = true;
fireInCulling = false;
[edit - Switch to false, not to true, will already be on true]
@davidlannan - It's not a matter of having the decals render before the shadows, it's a matter of having the decals account for the shadows when rendering to the fourth Gbuffer. I believe bac9-flcl is on the money, they might have changed something internally in the standard shader. As the standard shader variants of this system reference those files heavily it's likely this is the cause, investigating now.
@bac9-flcl - Sorry for the wait, investigating now.
For those interested in reducing compile times or optimizing for Android devices, I have a new patch ready to test internally.
This patch separates the system into different shader replacement methods for different subsets of devices (Standard, Mobile, VR). The shaders themselves have also been separated into different shaderLab files for each method. You can now specify which method you wish to use, then remove the irrelevant shaders for methods not in use. This, combined with removing the shaders for the projection types you aren't using should reduce the number of shader variants at least tenfold, reducing build times dramatically. I'll be writing a guide for new users, expect it in the next patch.
I've also added the option to disable masking. This, combined with the mobile shader replacement method, allows the system to run purely on Unity's inbuilt low-precision packed depth-normal shader replacement. As this is built into the rendering pipeline, it runs much faster than anything we can author ourselves (Until SRP's land).
Email is at (Support@LlockhamIndustries.com) if you're interested.
We're definitely interested in disabling masking and using standard depth/normal data for performance gains, that's a great idea!
Particularly if it's possible to set it up so there's a specific order. For us it's:
- draw level geo
- draw decals here
- draw all other rendering
That should be feasible without masking right? I mean really, it's absolutely the most common use case. Dynamic objects like debris can always be pushed to just before decals if we need to on a per case basis...
I'm still struggling with HUGE performance drop with Dynamic Decals.
If i draw one decal, FPS drops from 84fps to 25fps. And there is one decal and one camera that renders it.
I have minimap-camera that seems to be the problem, blood-decals are on "Decals" layer and Minimap-culling mask ignores that layer. So minimap does not even render decals, but anyway when i disable minimap-camera the fps goes back to 84fps.
Any advise on this? For now Dynamic Decals are not usable in my project.
Great news. Yes I been needing to ..for my Android game I'm about to release.
@hippocoder - You could use draw order in these scenarios as a substitute for masking. All you would have to do is set the objects you didn't want to be drawn on to be apart of a sorting layer higher than the default. Actually a really good idea.
@bac9-flcl @recon0303 - Send me an email if you want an early copy. Do keep in mind though that this is only recommended for mobile devices. I wrote high precision custom shader replacement. Unfortunately, using Unity's default shader replacement does result in artifacts. On mobile devices, these will hardly be noticeable, but on PC or VR, you will need the high-precision shader replacement. That said, eventually, if everything goes to plan and I get stop getting side-tracked writing tutorials/ shader optimizations/ fixes etc. The custom shader replacement should become as efficient as Unity's, and it will give us masking for free as well.
@teroojala - Could you send me an email (Support@LlockhamInductries.com) with profiler screenshots? (Deep profile if possible) and the debug information? (Window > Decals > Settings, while the game is playing) I have a build I'd like you to test out for me. I expect a small cost for the shader replacement, but 30ms is insane, and your draw-calls aren't increasing substantially, something unusual is definitely happening.
I'm also having same VR issue that not match with exact decal projection position.
I changed DynamicDecal.cs code as mentioned but had no effect.
( In fact fireInCulling = true; is already true in my source. )
Hi, i have these few errors
Assets/Dynamic Decals/Scripts/Core/DynamicDecals.cs(693,74): error CS0117: `CameraType' does not contain a definition for `SceneView'
Assets/Dynamic Decals/Scripts/Core/DynamicDecals.cs(706,70): error CS0117: `CameraType' does not contain a definition for `SceneView'
Assets/Dynamic Decals/Scripts/Core/DynamicDecals.cs(1148,49): error CS0117: `CameraType' does not contain a definition for `SceneView'
Assets/Dynamic Decals/Scripts/Core/DynamicDecals.cs(1161,49): error CS0117: `CameraType' does not contain a definition for `SceneView'
@Fabi88 - Which version of Unity are you using? It seems they've stripped the enum, or possibly renamed one of the values. I can work off the name of the camera instead, it shouldn't be an issue. Send me an email (Support@LLockhamIndustries.com) and I'll send you a fix .
I have found the Problem it was a conflict with this Asset https://www.assetstore.unity3d.com/en/#!/content/81759
I have deleted and now runs. yeah
but thanks anyway for the quick response.
Hello, We are using Lux shader with snow, is there any way to show decals over the diffuse texture but under the snow, Dor now everything is showing over the snow, and if we need some decals that are covered by snow there is a problem. Can you help us with that?
@kubaskia - This might be possible, but it would definitely be very tricky. I'm guessing, by looking at it, the lux shaders simply draw the snow in the same pass as everything else. If we could split that off and draw it after the decals have been drawn, in an additional additive pass/material it might be possible?
The alternative would be to change how the shader renders into shader replacement mask layer with a unique render tag, but the problem with this approach is that the mask buffer is binary, while I'm guessing you would like the snow to fade in over the top of the decals softly; and this approach would also break it for other shader replacement applications ie. post-processing effects.
If you can split the snow into a separate pass I might be able to help you.
Ok thank youfor help! Lux has his own deffered decal system, so I think it should be possible to make it work with your system too. https://forum.unity.com/attachments/08_lux_decals-jpg.184948/ Thee is special decal shader in lux shader pack so maybe you could in some way make your decal system work with that?
Is there chance that you will help us a liitle with that? If your system would work with different materials than your basic settings then we could use just lux decal shader with your system.
Will be there custom materials and shaders support? This is very important I think, in other way whole system has huge limitations.
Awesome asset but MORE docs please. Just changing Albedo color from script is complicated as the main class - ProjectionRenderer is not documented :/
FWIW - this seems to work for me to change color and texture (using version 2.0.3):
public GameObject myDecalPrefab;
public Texture2D t1;
GameObject myDecal = Instantiate (myDecalPrefab);
ProjectionRenderer pRend = myDecal.GetComponent<ProjectionRenderer> ();
Specular specProjection = pRend.Projection as Specular;
specProjection.albedo.Texture = t1;
specProjection.albedo.Color = Color.blue;
I actually did it simpler way (afer looking int ProjectionRenderer code):
not the point tho, those things should be documented
Hello, I am looking for a specific use case for this asset and was wondering if it's possible.
I'm making an RTS game and want a "decal" or "selection circle" underneath my unit's feet when any particular unit is selected. The problem is the projector performance in Unity is really bad, as I was told each projector has to re-draw whatever surface it is projected on for each projector.
In an RTS game, this can be hundreds of units, and if the selection decal/circle is projected on the ground (which is what I want it to be), it has to re-draw the ground hundreds of times......which is a terrible performance hit. Brings my game to unplayable framerates.
So, I was hoping your system might be able to handle say 150 projected decals/circles at once, without a huge performance hit? Is this possible with your system?
Thanks for any info.
(There is a technique I read about but have no idea how to implement. It involves using a rendertexture, getting the positions of each of my units, plugging them into the rendertexture, and then using only ONE projector to render the decals/selection circles for all of the units. I don't know how to use this technique though, was hoping maybe you might).
Hey, sorry for the delay guys.
@slimshader / @mneilly - Nice find, updating now. Edit - Projection Renderer Documentation
@Velo222 - The selection decals can definitely be instanced using this system, you should be able to draw between 500 and a thousand in a single draw call. The cost of shader replacement would be bigger than all the decals being drawn, and this would sill easily be cheaper than your projection renderer method. I would only recommend my system if you're projecting onto an uneven surface though. If your game worlds flat you could easily achieve the same results using a quad and the standard shader.
Hi! I´m getting this error in Unity 2017.3.
GetPixels32 failed: insufficent pixel buffer size (1), must be at least 4 x 4
LlockhamIndustries.Decals.CameraDatarawSplitPass(Camera, Camera, DynamicDecals, Shader, Boolean) (at Assets/Dynamic Decals/Scripts/Core/DynamicDecals.cs:1522)
LlockhamIndustries.Decals.CameraData:RenderToTextures(Camera, Camera, DynamicDecals, RenderTexture, RenderTexture, RenderTexture) (at Assets/Dynamic Decals/Scripts/Core/DynamicDecals.cs:1485)
LlockhamIndustries.Decals.CameraData:UpdateShaderReplacement(Camera, DynamicDecals) (at Assets/Dynamic Decals/Scripts/Core/DynamicDecals.cs:1425)
LlockhamIndustries.Decals.CameraData:Update(Camera, DynamicDecals) (at Assets/Dynamic Decals/Scripts/Core/DynamicDecals.cs:1029)
LlockhamIndustries.Decals.DynamicDecals:SuperLateUpdate(Camera) (at Assets/Dynamic Decals/Scripts/Core/DynamicDecals.cs:696)
Would your decal system work good for trails? If so, would there be a way using your system to give trails a tag or collision so different speed properties could be attributed for players on said trails?
Was thinking something like this: https://i.imgur.com/7ku3yzk.gifv
I'm having a lot of trouble getting your decals to render behind transparent cutout materials made with Amplify Shader Editor. Using Unity's standard material with the rendering mode set to "Cutout" your decals appear where they are supposed to (behind and in front when appropriate). But for my tree shader made with ASE the decals exclusively render on top of the objects. In ASE I've just set the render type to transparent cutout. I'm using deferred rendering and materials and force forward is *not* checked for the decals.
Sorry if this is more of an Amplify problem, it just seemed more appropriate to post here as I have no problems with the shaders otherwise.
@Mijail_Bitboys - I've been unable to recreate the issue in every version of 2017.3 available, beta or release. Could you shoot me an email (Support@LlockhamIndustries.com) with the rendering path, platform your building for, texture compression settings, and a screenshot of your camera's settings?
@Triggiano - This would definitely be suitable, however, so would plain quads, and you could get better performance using plain quads. You should really only use this package if your painting on uneven surfaces. For your use-case, I would recommend simply raycasting down and instantiating quads, then giving your quads a variant of the standard shader that supports instancing. If you do plan on varying up your levels with ramps etc. like below :
then I'd recommend switching to shader based decals, experimenting with a trail renderer or building a system that generates custom meshes on the fly (Would recommend if you know how). Keep in mind decals will only work with simple trails that can be broken into generic shapes and overlapped. A tire track, for example, would distort on turning when using a decal based approach (as decals are made up of square projections), while using a custom mesh or trail renderer would allow you to warp and bend your trail around corners.
@wadewt - The system relies on shader replacement, which has very strict standards on how shaders need to be built to work with it. a RenderType tag must be present and all the properties of the shader must use standardized names (_MainTex, _Color, _Cutoff). Send me an email (Support@LlockhamIndustries.com) with your shader attached and I'll take a look at it for you .
Hey adding Dynamic Decals to the project is causing very long build times, how to fix that?
I recently bought your package Dynamic Decal. It works pretty well, good job
But unfortunately, we need to use decals on a specific shapes and not just on a square or a circle. In fact, we generate custom collision shape with a specific editor that allows users to define their own shape from 3 to 10 points. All these shapes are convex.
Once we have these shapes we would like to add your decals system on the entire surface of the shape without use any texture. For example, if we generate a triangle, we would like to have a triangle colored decal. As we could generate any type of shape from 3 to 10 points it is not possible to have the corresponding texture.
So, we contact you to know if you could help us to modify a little bit your shader to take into account the shape of the gameobject? Or just send to the shader the point list of our shape to clip every point that are outside of the shape?
P.S: i sent you mails but did not received any answers so I try with the forum
@slimshader - I have a working on a solution now, it will be in the next patch. Send me an email (Support@LlockhamIndustries.com) and I'll send you an early copy.
@NarLoke - Couldn't find your first email, but got the one from your personal address, the reply should land any second .
That's cool, will wait for update then. Btw. for example Beautify asset has settings page that allows for disabling unused shader stuff exactly for this purpose.
Yep, thx for your quick answer
Hey, love the plugin. Using it with a PS4 game atm and hopefully get around to XBone and switch, and I'd love to help out with making sure the plugin is at least working / building on those platforms.
I did a test on PS4 thru Unity 2017 2.0p4, only big issue was shaders failing to compile due to ambiguity. LMK if you need the full logs.
Basically, the problem was a lerp ambiguity in ForwardPass.cginc
Ln:36 " c = lerp( 1 , c, fragment.occlusion); " should be " c = lerp( half3(1,1,1) , c, fragment.occlusion); "
After making that change, I got it working on PS4.
Other things to note is Reflection can be pretty expensive on different platforms. For the include behaviors functionality you have in the Pool system, I'd suggest just instantiating the Projection prefabs for the include behaviors part, and doing the new GameObject -> copy Projection settings if include behaviours is off.
Also, as a headsup, you can't use Linq on some platforms, PS4 being one of them. Pretty sure the plugin's runtime is clean, but just in case.
Again, love the plugin, and while I've adjusted the shader on my side, if you can incorporate it into future versions so anyone on PS4 doesn't have to change it, that would rock!! <3
Hello! Very much enjoying Dynamic Decals right now but having one issue with it. I'm using objects/materials in my scene that are GPU instanced and have per instance properties assigned via MaterialPropertyBlock. These objects are actually unrelated to my use of Dynamic Decals -- the decals I'm using are only projected to the Terrain layer, nothing else -- however when I use Dynamic Decals, I get a whole bunch of additional draw calls for these objects (on RenderForward.RenderLoopJob, despite that I'm using Deferred for everything else) coming from Dynamic Decals's DepthNormalMask_Packed shader. They don't get instanced, resulting in an additional batch and SetPass call for every single object. The decals themselves are still instanced properly and result in no additional unnecessary SetPass calls.
@Llockham-Industries : I'll send you a small repro via PM. Would greatly appreciate any insights you might have. It's very possible I'm just missing something simple -- a toggle in a shader or decal setting that needs to be ticked.
My scenes have a very large number of duplicated decals and other objects, and the decals themselves seem to be instancing and performing great, but it'll break my use of it if they cause my other objects to no longer benefit from instancing.
[EDIT: By the way, this seems like it might be similar to the issue that @kotis21 reported a couple months ago, but I'm not sure if there was any definite resolution to that.
Hello wondering if anyone else has encountered this issue? I've found that the decals don't appear on certain devices it can be a completely blank scene with just one default decal and it will appear fine on a Google Pixel and an iphone 7 but doesn't appear at all on an samsung s7 or s6 has anyone else encountered this / know why this might be happening? (Loving the asset despite this)
Is there any news on a release date for an/the update? I am looking for faster build times as well.
Currently my project takes upto around 5 minutes to build
Thanks in advance!
In new Unity versions from 2017.3 I guess you can split files of code that get compiled. Just put your files into bundle and compile them instead of all project files that has already been compiled and you don't change. But compile time matters, maybe the developer will reduce it, but it's hard to imagine how.
This product is great, but I'm having issues when using it with VR.
I'm seeing the same issues mentioned above posted by @skom01 @TeemuMevea, I've tried changing the fireInCulling = false; code, but the problem is still happening.
I'm using VRTK, not sure if this could have something do with the issue.
One other thing I've noticed, once a decal is projected and I rotate my head in VR while looking at it, the decal seems to move on it's own axis with the rotation from the headset. Seems very weird.
Bought the asset yesterday and tried to get it to behave with no success. I'm getting tons of extra batches and at worst 5x more SetPass calls even when there's just a single decal somewhere in scene. It's pretty much completely unusable for me.
Am I missing something obvious here or is this expected? I know the scene has tons of drawcalls even before adding any decals but more than doubling them just to draw a few decals doesn't seem right...
Project is using deferred rendering and there are a few additional cameras (some of which are using forward) which I tried to disable and tried using the ProjectionBlocker -component which manual suggests. Didn't see any noticeable performance increase in either case.
Below is a typical stats window of a scenario where almost batches jump from 7600 to 16000 and SetPass calls from about 1000 to 5000(!). First image is before Dynamic Decal and second one is after.
And profiler from a similar case. IIRC the above screenshot had unitys occlusion culling enabled and below does not. Same scene / project otherwise. Dynamic Decals appears to spend about 70% of the total frametime re-rendering the scene. What is it doing there? Is this really necessary if in deferred you have the depth buffer already anyway?
Tested on GeForce 1070 and AMD Ryzen 1400.
@Dime_Dan - Thanks for the suggestions, included your shader tweak into the next build, looking into optimizing the current pooling. Possibly instantiating the first pass settings allowing users to pre-warm the pool.
@PieterAlbers, @MakabreGaming - The new version has a solution to build times. Splitting up shaders into different groups of variants that are needed in the build. There's also a guide on how to remove the variants you don't need which should increase build times dramatically . Also included a bunch of other new tutorials/guides/info. It's been submitted, email me (Support@LlockhamIndustries.com) for an early copy.
@Ripley_UK - New build should fix this, it's been submitted, email me (Support@LlockhamIndustries.com) for an early copy.
@deliberative, @PixelMind - Unfortunately these both look like more cases in which rendering shader replacement in forward rendering (Only option available) is breaking batching/instancing that would otherwise be suitable for deferred rendering. There isn't an easy solution to this problem. I'm still wrapping my head around SRP's, there is definitely hope there, as it should be possible to explicitly request something be rendered without lighting, allowing it to be batched, but as this is an entirely new rendering architecture, support for this is still a fair way off (SRP's also still considered experimental).
Currently, if you have access to all your shaders, you could explicitly declare what you want need to be in shader replacement with custom render tags, then only draw what needs to be drawn on / occlude decals into shader-replacement. However in most cases, this will be everything anyway, and it's not really feasible to have you write custom shader tags into every shader you use to support the system. Alternatively, I can offer you a refund (Support@LlockhamIndustries.com) Sorry I can't be of more help.