Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Decal System

Discussion in 'Assets and Asset Store' started by Dantus, Jun 29, 2012.

  1. sgoodrow

    sgoodrow

    Joined:
    Sep 28, 2012
    Posts:
    150
    Dantus, great plugin, we really appreciate having access to it!

    I saw a reply a few pages back (from January) about how the Pro version can edit the projection renderers so that lightmap scale can be changed. This is great! I was wondering though, this means that the scale is constant for all projections from that renderer, correct? Is there any way to inherit the scale from the target instead, or would this not be possible?
     
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Yes, that's right, the scale is constant for all projections from that renderer. Using the scale from the target is not possible in general because there may be more than one target and those may have different scales.
    Would it be useful, if we could provide a script that you place in the same game object as the DS_Decals script, where you can drop a mesh renderer from which the lightmap scale needs to be used? I am unsure how easy, hard or even possible at all it is to implement something like that.
     
  3. sgoodrow

    sgoodrow

    Joined:
    Sep 28, 2012
    Posts:
    150
    Thanks for the confirmation. I figured that was a limitation of the system (and Unity). Just something to work around I suppose.

    Probably unnecessary in that form. I'm not sure how it is done, but the NavMesh builder uses renderer raycasts -- if that could be done then each projector could get the target renderer itself (at least one) with a raycast. I don't think you would want to automate the process of setting the scale, but listing the scales for all target renderers would make it easy to see problematic targets and to choose a good medium scale to fit between several targets.

    Just a thought. Renderer raycasting would be a neat thing to figure out for a lot of purposes...
     
  4. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    I see your point, but I am not sure whether it would help to have a semi-automatic approach, as at the end the "good medium" scale needs to be set manually anyways. If you have to perform manual adjustments anyways, you can directly set the scale. You can open the lightmapper, show the resolution, have a look at the mesh that is produced by the Decal System Pro and adjust the scale until you get what you want to have.
    Maybe I just struggle to see where in the lightmapping workflow a renderer rayycasting would be helpful. How should the workflow be in your opinion?
     
  5. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
  6. sathya

    sathya

    Joined:
    Jul 30, 2012
    Posts:
    236
    50% off. that sounds cool. i am using free version now. planing to go for pro version. Would like to know if pro version has performance improvements over free version. Thanks. waiting for your response.
     
  7. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    You find all the differences here:
    http://www.edelweissinteractive.com/products/decal-system-pro/decal-system-pro-features/
    • The "Further Runtime Improvements" were all made to increase the performance at runtime.
    • Vertex colors may help you to use fewer decals and lead to memory and performance improvements.
    • Maybe even the Decals Mesh Minimizer may help a little.
     
  8. angelodelvecchio

    angelodelvecchio

    Joined:
    Nov 15, 2012
    Posts:
    170
    This worth every damn penny! Please folks this are in madness this week, buy this great piece of software and support this great developer !


    Many thanks!
     
  9. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Thanks for the kind words!
     
  10. wolga2

    wolga2

    Joined:
    Jul 4, 2012
    Posts:
    6
    Hi!
    First of all thank you for this! :)
    I create a infinite terrain (deformed plane meshes, not the UnityTerrain) at runtime. It builds up in front as the player moves and will be destroyed in the back. Therefore I don't have the mesh before I press play. What I now want are Decals that are spawn on the mesh. First of all, my problem is that I just can not achieve the projectors to show the projection from beginning on. I will have to move each of them a bit at runtime to make the decal use the generated mesh as the projection mesh. I tried it with The DynamicObject script also, but it doesn't work eighter. It would use too much preformance anyways. I really need the decals to be spawned and shown on the mesh from the beginning on. And they need to be calculated just one time at runtime, when the terrain-mesh is built up. How could I achieve that?

    Thank you!!
     
  11. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    All kinds of runtime usage needs to be explicitly scripted and will not just work. The way it is implemented in the Unity editor is in general too expensive at runtime.
    There is a bunch of bullet example scripts that demonstrate how decals can be created at runtime. You may also have a look at this script: http://forum.unity3d.com/threads/141792-Decal-System/page28?p=1247584&viewfull=1#post1247584

    Please let me know if you have further questions.
     
  12. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,393
  13. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
  14. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,393
    thanks :)
     
  15. multix

    multix

    Joined:
    Aug 5, 2013
    Posts:
    16
    Just bought this asset in the last minutes of this madness sale to support your efforts. Keep up the good work! Can you outline some plans for future changes and/or features? If you always keep performance on mobile and good documentation in mind as a basis for further improvements, I would be happy.
     
  16. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    @multix, I consciously don't publish future plans in general, unless a feature is planned in detail and all the problems regarding it are already solved. There are several features in the pipeline and you can expect some usability improvements (Decal System Pro only) in the near future, but it is not yet the time to go too much into the details about that.
    As the Decal System just produces meshes based on the decal projectors and they are drawn by Unity like any other mesh, I would have to mess up the whole system in order to weaken the performance on any platform. Be assured that this will not happen. You can certainly notice performance differences for runtime decals from time to time, but this will never have dramatic impacts.
    If you have a look at the release notes, you can see that there was a bunch of releases already, some with relatively big changes. Nevertheless, the documentation was consequently updated and this will also happen in future releases. When new features are introduces, you will often find a video on YouTube which describes the functionality.
    If you can't find information or if you think there is not enough information about certain areas or if you have the impression that the documentation lacks or is not up to date, don't hesitate to contact me! The same is certainly true for any kind of question regarding the Decal System. If something is not clear enough or if you have feedback, feature requests, bug reports, just get in touch with me, either here in the forum or by email. If it is easier to get rid of an issue through Skype, we may also solve a problem like that.
     
  17. wolga2

    wolga2

    Joined:
    Jul 4, 2012
    Posts:
    6
    thank you very much for taking the time to answer me!
    i had quite a bit, but i could make it work for me with the script you recommended :D i now assign my terrainmesh after generating to the affected meshs of the runntime decals updater and then enable the script.

    great work anyway! thanks! :)
     
  18. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Good to hear it worked for you!
     
  19. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    859
    Hi Dantus
    Looking at getting a decal system and it seems yours is the most feature rich and cool looking, but need to check on a couple of points. Is it possible once a decal has been applied and positioned to have that converted to a simple Mesh, for example I want to project a logo onto an animated box lid. I could as shown in your video attach the decal system as a child of the animated lid but I would rather be able to create the decal then bake it to a simple mesh object then I can use a mesh combine script to merge that directly into the box lid object. Is that possible with your system? Even if its a matter of being able to access the decal mesh data so I can create the mesh object myself.
    Thanks
    Mike
     
  20. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    You don't need to convert the decal into a mesh, because that happens internally anyways. You can access it by script.
    What is the idea behind baking the decal into the other mesh. Usually that is not a good idea, because decals are transparent, while the the objects onto which the decals are projected are opaque. That means you can combine them, but it has absolutely no positive effect, because there are still going to be two different materials and as such at least two draw calls. I may be able to help you if you explain me the idea behind this.
     
  21. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    859
    Well in the scenario I would like to use your system in I could be adding dozens of decals to an object, all those decals would be coming of the same texture and using the same material so they could be combined to one mesh.
     
  22. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    The Decal System does that automatically for you.
     
  23. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    859
    The end objects are also required to be serialized and transferred over a network so other players can see the results, I know that could be done serializing the projector positions and values etc but as the mesh is transferred already would just be simpler to combine the decal meshes.
     
  24. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    I am not sure how much time you spent with the Decal System so far, so please let me know if this is already clear for you.
    If you create a decals game object, you can place a several decal projectors. All those projectors are batched and as such you usually only get one mesh.
    You have to be careful if you want to combine several of those meshes. This can lead to z-fighting due to floating point issues if they are spread around a huge area. If they are close together, it can work, but it will not be easily possible to add projectors to those decals. I would need to have more information about your actual use case to make any suggestions.
     
  25. ironwolf

    ironwolf

    Joined:
    Oct 26, 2010
    Posts:
    7
    Hi Dantus

    I see that you put a lot of effort helping people solve their problems with Decal System, so I hope that you will be so kind and help me as well.

    I am using Skinned Decals with Skinned Mesh Renderer in Decal System Free, and it works great with bones animations. The problem starts when I try using Morphing (BlendShapes). In that situation Decals are always created from Mesh with Blend Weight = 0, and stay that way regardless of Blend Weight changes. I try change BlendWeight directly, and by Animations, but it is always the same.

    Example:
    We have a Soldier. He is running, and generaly moving with bones animations, and Decals work great. But the soldier can also change his body fatness. The fatness change is made by Morphing, and unfortunately in that situation Decals does not work as expected. The decals are always created from "slim" models (Blend Weight 0) regardless of his true weight (fatness).
    When we shoot slim soldier in his stomach the bullet decal is created properly. But when He becomes fat, the decals are "consumed" by his stomach. When the soldier is fat already before getting shot then Decal is created the same place (inside his stomach) as it would be slim.

    From what I see Decal System copies mesh bones from the object to the Decal. So I wonder if it is possible to copy the Morphing (BlendShapes) as well? Could you tell me please, do I need a Decal System Pro for that, and how to achive this if it is possible?

    Thank you very much in advance for any help and I looking forward to your reply.
     
  26. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    You are absolutely right that this is currently a limitation of the Decal System. Blend shapes didn't exist when Skinned Decals were implemented and so far almost no one had a need for it.
    There is a workaround for this, but it requires you to code it. So let me ask you first whether you need it in the editor, at runtime or both? If you only need it at runtime, it is going to be relatively simple, otherwise we need to spend some time on it.
     
  27. ironwolf

    ironwolf

    Joined:
    Oct 26, 2010
    Posts:
    7
    Thanks for extremely fast response. I am very glad that there is a workaround for this. I need it only at runtimie, so I hope the solution will be really simple as you suggest. It is not a problem for me to code it if you only provide me some advises.

    I was looking into SkinnedMeshRenderer Class in Unity Docs, but it looks like there is no Variable for BlendShapes, so I could not simply copy it to other mesh (like bones), and I am stuck on it right now, so any clues would be very helpful.

    Please also tell me if I need Decal System Pro to solve this problem or is it possible on the Free version?
     
  28. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Please give me a little time to try it out. I was told by a customer that they were able to bake the skinned mesh, and use that one to perform the decal cutting operations and apply it to the decals mesh.
    That means you would need to recalculate the decal each time when the blend shape is changed. I am going to have a closer look at it and let you know.
    If that solution works, it doesn't require Decal System Pro.
     
  29. ironwolf

    ironwolf

    Joined:
    Oct 26, 2010
    Posts:
    7
    Great - Thank you very much for your commitment, and I look forward to a solution when you have it ready.
     
  30. NightmarexGR

    NightmarexGR

    Joined:
    Jun 7, 2012
    Posts:
    200
    Hello , what i want is a decal system that supports moving for example i have a player and i want to project a skull to the terrain below him , of course the terrain is not flat.
    What i have tried with the free version of this asset is to move the projector/decal in real time but everytime i do so i get 3 errors and then the editor crashes . I use Unity 4.3.4 Pro :p
     
  31. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    If you are moving a decal every frame, it is usually recommended to use a Unity projector.
    Still, could you post the error messages?
     
  32. NightmarexGR

    NightmarexGR

    Joined:
    Jun 7, 2012
    Posts:
    200
    Here you go :
    I was creating my own decal system and i ran into that dead end beeing not able to update them in real time , then i went for inspiration and thats how i found you.
    And i just realized you are the creator of Cloud System Free, good job for your assets, you are doing great keep up like this.
     

    Attached Files:

    • hy.PNG
      hy.PNG
      File size:
      33.1 KB
      Views:
      520
  33. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    You are moving a decal projector which computes the lightmap. You are not allowed to move them at runtime, though Unity should certainly not crash because of it. I'll have a closer look at that. If you have to move decal projectors, make sure they don't compute the lightmap dynamically.
     
  34. evilt0m

    evilt0m

    Joined:
    Jun 8, 2013
    Posts:
    7
    Hi,
    first thing, I love that decal system. Awesome work there.
    But now I've got a litte problem with decals and the unity projector.
    I used the decals for covering the floor of a level with some stuff and a unity projector to have a blob shadow below my characters. Now if the character moves over the decals, the blob shadow is rendered below the decal.
    How can I avoid this?

    Thanks
     
  35. NightmarexGR

    NightmarexGR

    Joined:
    Jun 7, 2012
    Posts:
    200
    LoL that was what i just experienced but in my case this was the effect i wanted so i guess i am lucky , though i am sure projectors were broken idk why they suddenly worked for me :3
     
  36. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    The shaders that come with the Decal System use a IgnoreProjector tag. Just open the shader and remove it.
    http://docs.unity3d.com/Manual/SL-SubshaderTags.html
     
    evilt0m likes this.
  37. evilt0m

    evilt0m

    Joined:
    Jun 8, 2013
    Posts:
    7
    Didn't work for me. But I found another solution.
    Added "Queue" = "Transparent+1" for the projector ;)
     
  38. konsnos

    konsnos

    Joined:
    Feb 13, 2012
    Posts:
    93
    Hello,

    I have a problem with the assets. I am trying to get it to work on a huge terrain with lots of meshes on it, and I get the warning "A mesh onto which a decal should be projected is not readable!". Sometimes the decals are visible, sometimes are not.

    I have created an atlas with 4 textures 512x512, and I have created the Projectors with these. However except from the above warning and error, only 3 of the decals work. I move another, and another gets invisible, and so on...

    Any suggestions about these problems? Am I doing something wrong?
     
  39. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    @konsnos, you are probably facing two different issues here.
    First, you have to make sure that each mesh onto which you want to project a decal is readable. You have to specify that in the import settings for the mesh:
    http://docs.unity3d.com/Manual/FBXImporter-Model.html
    If the mesh data is not readable, the Decal System can't read the mesh data and that makes it impossible to compute the decal mesh.

    The visibility of the decals is a different topic. Which shaders are you using? Does it disappear on the terrain only? Has the terrain LOD switching an influence? It may also happen if you distribute lots of decal projectors from the same decal instance over a huge area. Try to make a decals instance with just one projector to see whether the issue also exists like that.
     
  40. konsnos

    konsnos

    Joined:
    Feb 13, 2012
    Posts:
    93
    Hey @Dantus . Thanks for the response.

    I've rechecked my meshes and they are all readable but the problem persists. I also did the following. I've deactivated the Meshes in the Affect section (left only Terrain) and I still get the same error about the mesh. Now instead of 4 to reach the bug it took 6 projectors to show again the bug. To avoid it I've created an extra projector which became invisible and enabled the previous one. Last decal I move becomes visible and gets another invisible.

    Just to clarify my project is the following: Terrain, and lots of different meshes on it. I've got a texture atlas of 1024x1024 containing 4 texture of 512x512 size. I'm adding them as projectors with scale 300,80,300. After a few of them, some get invisible. I get 2 Decals Mesh Renderer GOs and none includes the invisible projector. The shader used is Decal/Colored/Transparent Diffuse Colored.
     
  41. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    There are unreadable meshes. The Decal System finds them and that's why it displays the warning. But there is a flag "Skip Unreadable Mesh" per projector to avoid that warning. If you are sure that no relevant mesh is unreadable, the use this flag.
    If the projectors have such a huge size, you should only have one per decals instance. Several decal projectors of that size can easily lead to numerical imprecision and as such to flickering or to invisibility of the decals. It may be possible that it works even with several projectors, but I need more information about your application, why you need such huge decals, what will be visible at runtime, ... I would need to see some screenshots as well and most preferably get a reproduction of the issue.
     
  42. konsnos

    konsnos

    Joined:
    Feb 13, 2012
    Posts:
    93
    The terrain had some trees. Maybe it detected these as not readable. Otherwise I have no idea what it detected.

    I tried what you said. Created several decal instances and added one projector to them. It worked with all the decals I wanted to add even with scale of 600x80x600. I also stopped receiving the above error for some reason. Now it spams me with some clean up messages which I hope are not something serious. Otherwise problem solved :) Thanks @Dantus .
     
  43. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Are the clean up messages from the Decal System?
     
  44. konsnos

    konsnos

    Joined:
    Feb 13, 2012
    Posts:
    93
    Hm, no idea. The message is just "Cleaning up leaked objects in scene since no game object, component or manager is referencing them
    Texture2D has been leaked 20 times." . And it only happens with the decals. I only get it when I save my scene.
     
  45. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Some versions of Unity show this message, if you have a Decal System object selected and hit save. The newest versions don't have this issue anymore as far as I have seen. This was caused by a Unity bug and has not negative impact at runtime.

    Edit: I just checked Unity 4.5 and the issue is still not resolved in there.
     
    Last edited: Jun 14, 2014
  46. NightmarexGR

    NightmarexGR

    Joined:
    Jun 7, 2012
    Posts:
    200
    Wait what ? That fking error is because of the unity version ?! i am breaking my head on how to solve it for 3 days :mad: Hope that rumor is true , i will update my version and check cause i get this from 3 different systems i have created without a reason while in older versions it didnt so this might be true , i hope so :S

    Edit: One of these systems is my own decal system and i really dont want to have any form of errors ever in the console so try to eliminate them all even the harmless ones , thats why i got so upset.
     
  47. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    The warning in the Decal System is because the textures are dynamically loaded. If you hit save, Unity reloads those textures and the old versions leak. When I implemented the Decal System, there was no known workaround for the issue. This warning is only shown if the Decal System's inspector is being shown while the user saves. It is not shown in general.

    I have edited my previous post. This issue is still present in the current version.
     
  48. NightmarexGR

    NightmarexGR

    Joined:
    Jun 7, 2012
    Posts:
    200
    Yes i have figured that already, even if my decal system works totally different than projectors (Creates a flexible mesh and paints it on runtime) ect. i still load the textures as you said and so i get that error and yes i am working on a solution but i am too busy to complete it right now. My basic thought was to create an editor script and everytime i press save before the save function, to close the scripts of the decal system so it doesnt leak but sometimes it doesnt work so its not perfect :(
     
  49. devias

    devias

    Joined:
    Jan 23, 2014
    Posts:
    7
    Please tell me what is decalsMesh? Where did you initialize it?
     
  50. devias

    devias

    Joined:
    Jan 23, 2014
    Posts:
    7
    And could you also tell me what is the dsDecals variable?