[RELEASED] Dynamic Decals

Works for me in the editor on 2018.3.2f1:

and in a Desktop build:

(as always, works with Standard pipeline only)

[mention|AdRCyGIJp6wTwXSl3Xb/WA==] Sure. I just made a simple scene with a cube and a ProjectionRenderer and it worked except for WebGL (as mentioned in the other thread ).
To me, standalone PC build works just fine. Perhaps check your Quality/Graphics settings? Iā€™m not sure.

4138402--364186--Editor.png

Works for me in 2018.3, however, the ā€œpriorityā€ setting for decals seems to have no effect. I donā€™t know that it ever did, but it definitely isnā€™t working for me in 2018.3.5f1.

Also, Iā€™m constantly getting an error warning; ā€œAssets\Dynamic Decals\Scripts\Editor\DecalSettings.cs(388,32): warning CS0649: Field ā€˜DecalSettings.draggedMaterialsā€™ is never assigned to, and will always have its default value nullā€. No massive deal, but annoying.

Iā€™m looking for alternatives to Dynamic Decals and would recommend that you do the same. Stuff isnā€™t going to get fixed and the situation will only get worse.

@GfK You can put:
#pragma warning disable 0649 at the top of the file to make the warning go away*.*
Or create a csc.rsp file in the root of the Assets folder containing -nowarn:0649 to disable the warning globally, because many assets started doing this in the new Unity version.
The new compiler in 2018.3 reports some false positives (like everything with the [SerializeField] attribute, which can also be fixed by assigning null or default to it).

Personally, Iā€™m going to stick with this asset as long as it lasts. With some help, I got it working in WebGL again and so far I didnā€™t notice any other issues. There are apparently decals in HDRP, but thatā€™s a project-wide decision which will lock you out of most platforms apart from PCs and newest consoles.

1 Like

Hm, thanks. Iā€™ll give that a go.

Another problem in Unity 2018.3.5 - has anybody else noticed that decals will suddenly stop being drawn in the Scene view?

They draw fine in scene view IF the game is running, but when itā€™s not, theyā€™re all invisible which makes placement practically impossible. I didnā€™t even change anything - just played my game, then stopped it, BOSH - everything invisible.

[edit] Oh, it transpires that the priority parameter doesnā€™t work in deferred rendering mode. Didnā€™t spot that in the docs, just trial/error.

Allrightyā€¦ Iā€™ve reverted back to the original code for the latest version of Dynamic Decals and I donā€™t seem to be having trouble with decals not drawing (your fix for the 0649 warning worked - thanks).

So at the moment itā€™s looking like the problem might have been my previous fixes for the glut of warnings that appeared in 2018.3.3 with PrefabType and GetPrefabType becoming deprecated in Unity.

I have eight such warnings and if anybody can advise what I need to do in order to futureproof here, itā€™d be massively appreciated since it would appear I may have gotten something wrong before.

I went ahead and made changes to the following code (ProjectionRenderer.cs, line 334 onwards):

        private bool Register()
        {
            if (this != null)
            {
                #if UNITY_EDITOR
                PrefabType prefabType = PrefabUtility.GetPrefabType(gameObject);
                if (prefabType == PrefabType.ModelPrefab || prefabType == PrefabType.Prefab) return false;
                #endif

                return DynamicDecals.System.Register(this);
            }
            return false;
        }
        private void Deregister()
        {
            if (this != null)
            {
                #if UNITY_EDITOR
                PrefabType prefabType = PrefabUtility.GetPrefabType(gameObject);
                if (prefabType == PrefabType.ModelPrefab || prefabType == PrefabType.Prefab) return;
                #endif

                DynamicDecals.System.Deregister(this);
            }
        }

PrefabType is replaced with PrefabAssetType.
PrefabUtility.GetPrefabType is replaced with PrefabUtility.GetPrefabAssetType.
Iā€™ve replaced PrefabType.ModelPrefab with PrefabAssetType.Model.
Iā€™ve replaced PrefabType.Prefab with PrefabType.Regular.

These changes, while logical and correct in my mind, are causing decals contained within prefabs to NOT draw in the scene view. Which makes placing decals virtually impossible.

This is driving me up the wall, if Iā€™m honestā€¦

I think Iā€™ve sussed it. For anybody else who comes across this, change the two methods above to:

       private bool Register()
        {
            if (this != null)
            {
                #if UNITY_EDITOR
                PrefabAssetType prefabType = PrefabUtility.GetPrefabAssetType(gameObject);
                if (prefabType == PrefabAssetType.Model) return false;
                #endif

                return DynamicDecals.System.Register(this);
            }
            return false;
        }
        private void Deregister()
        {
            if (this != null)
            {
                #if UNITY_EDITOR
                PrefabAssetType prefabType = PrefabUtility.GetPrefabAssetType(gameObject);
                if (prefabType == PrefabAssetType.Model) return;
                #endif

                DynamicDecals.System.Deregister(this);
            }
        }

I didnā€™t have to change anything and it worked in 2018.3 just fine. warnings are just that, warnings, I wouldnā€™t worry about them until they become errors.

True enough, but in this case I donā€™t think it matters whether we fix it now or later - itā€™s going to need doing.

Man, I am very excited about native decals. But is there any way to create them for mobile, without HDRP? It is very needed for me, as Dynamic Decals has some bugs with Android 4.4.2 and 6 versions. I spent tens of hours to debug it but I am tired. Help me please((9((9

Has anyone encountered issues mixing dynamic decals with particles?
Iā€™m getting this ZDraw issue whereby the decals below do not pass through particles.
Seems to be consistent on both Deferred and Forward modes.
Does anyone know how to get around this? It doesnā€™t seem to be my particle systems as its consistent across all shader types.

4251901--379081--Particles.gif

7 Likes

Absolutely!

It would be great if we could have the code as open source.

4 Likes

Hey guys,

Iā€™m having trouble getting the decals to render properly with a 3rd party terrain shader. Iā€™m trying to display the decals directly on my terrain (i.e. the decals render on my terrain with all of itā€™s hills and valleys etcā€¦).

Using the standard Unity shader it actually works fine. But when I use the CTS terrain shader it does not. Iā€™m using 3rd party terrain shaders from the ā€œCTS (Complete Terrain System)ā€ asset store shaders. Any ideas?

Also, Iā€™m very sad to see this asset was deprecated as well. I am not going to go to the HDRP until they get actually good particle shaders going for it, and until SpeedTree can get itā€™s trees working with it. But that could be months, if not a year away.

I just purchased ā€œEasy Decalsā€ off the asset store to try to replace this asset, and the performance was TERRIBLE. This is the only decal asset that worked for my game. This puts me in a big bind. :frowning:

Had the same issue some time ago, I think it was related to the CTS Cutout shader
Basically I think you need to turn off the Cutout option on your CTS shader (bottom of the cts profile if I remember properly) and it should work on terrain

Thanks for the reply Necka. I looked at that option and it was already unchecked (not in use). I tested it with both the option checked and unchecked, but the decals still do not render on the terrain properly, unfortunately.

Thank you for the suggestion though. It was worth a shot. :slight_smile:

I bought Easy Decal recently too. The thing you have to remember is that itā€™s creating mesh decals on the fly, which is why itā€™s slow - like native Decal projectors in older strains of Unity. You can make it faster by using plane instead of box projection, or you can bake decals and only update them when they move. Further, you can use screenspace decals (SSD) which are MUCH faster, like Dynamic Decals, but you do lose the ability to project decals onto specific layers. For me, all of it is a compromise and I donā€™t know if Easy Decal is anywhere near a replacement for this. Itā€™s OK if you arenā€™t moving a load of stuff around, but if you are - forget it. For me, the compromises Iā€™d have to make are proving too much of an ask right now. If you could use SSDs with Unity layers in the same way as Dynamic Decals handles it, thatā€™d be fine. Itā€™s possible, clearly, but they just havenā€™t done it.

I donā€™t mind using Unity 2019 (without HDRP/LWRP, obvs) with Dynamic Decals, BUT, Iā€™ve noted an issue where on the first run, the decal projection flashes white before it renders properly. If itā€™s going to do that when a user first runs my game then itā€™s completely unusable.

The author really needs to pick up support again, or open-source it. There is still a huge demand for this.

7 Likes

hey guys,dose any one know how to change the projection render properties through script?
for example how do i inscres the emissive slider value in projection component

Just curious, is anyone using this asset in a game that is built in Unity 2017?

I purchased it a while back, but took it out of my game because of performance reasons (Iā€™m making a VR game and there were issues in single pass stereo rendering.

I originally tried it in Unity 5.6, but havenā€™t tried it sinceā€¦