Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Strumpy Shader Editor [Now Open Source]

Discussion in 'Works In Progress' started by Tim-C, Aug 2, 2010.

  1. Bruno2Silva2

    Bruno2Silva2

    Joined:
    Mar 26, 2015
    Posts:
    17

    Attached Files:

    Last edited: Oct 25, 2015
  2. Erind

    Erind

    Joined:
    Jul 23, 2014
    Posts:
    56
  3. hnoor77

    hnoor77

    Joined:
    Jan 14, 2016
    Posts:
    2
    This graph editing should work with the non pro version when it is released but the preview may need some severe wrangling as it utilizes drawmesh and rendertextures.
     
  4. Erind

    Erind

    Joined:
    Jul 23, 2014
    Posts:
    56
    can strumpy shader make shader for N3DS ?
     
  5. austint30

    austint30

    Joined:
    Jul 1, 2013
    Posts:
    70
    Does this work with Unity 5? I want to use this to make custom shaders and I don't know a thing about hard coding them. I know there is Shader Forge but I'm not spending that much on just a shader editor!
     
  6. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    408
    Your best bet is to just try it with Unity5. Maybe read through the last dozen pages, see if anyone's had to fix some stuff on import. Likely, the shaders WONT work well (fast/good looking) compared to Unity's Standard shader system and defferred lighting, simply because that requires features Strumpys doesn't have i think.

    I think the vast majority of Strumpys users have moved onto SF. Either wait for it to go on sale, or pick it up at the price it is are your only two real options if you want to use nodes to makes U5-level shaders.

    Or, you could post an offer, put some $$ up for someone to make a shader for you if you just need one or two.
     
  7. austint30

    austint30

    Joined:
    Jul 1, 2013
    Posts:
    70
    Or I can just use Unreal Engine 4 which is what I'm doing by the way. It's simply amazing how good looking you can get things to look with it's Material editor!
     
  8. o0_ICE_0o

    o0_ICE_0o

    Joined:
    Apr 3, 2014
    Posts:
    21
    I get this error when i open SSE and the preview window wont update :(

    Shader error in 'ShaderEditor/EditorShaderCache': 'vert': output parameter 'o' not completely initialized at line 79 (on d3d11)

    Compiling Vertex program with DIRECTIONAL SHADOWS_OFF LIGHTMAP_OFF DIRLIGHTMAP_OFF DYNAMICLIGHTMAP_OFF

    AND A WARNING OF SOME SORT

    Shader parsing error System.IO.FileNotFoundException: Could not find file "D:\PROJECTS\RPG testings\Testings rpg\Temp\CgBatchOutput.shader".
    File name: 'D:\PROJECTS\RPG testings\Testings rpg\Temp\CgBatchOutput.shader'
    at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00209] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.IO/FileStream.cs:305
    at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0
    at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
    at System.IO.File.OpenRead (System.String path) [0x00000] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.IO/File.cs:363
    at System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) [0x00077] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.IO/StreamReader.cs:167
    at System.IO.StreamReader..ctor (System.String path) [0x00000] in <filename unknown>:0
    at (wrapper remoting-invoke-with-check) System.IO.StreamReader:.ctor (string)
    at StrumpyShaderEditor.InstructionCounter.CountInstructions () [0x00000] in <filename unknown>:0
    UnityEngine.Debug:Log(Object)
    StrumpyShaderEditor.InstructionCounter:CountInstructions()
    StrumpyShaderEditor.NodeEditor:Update()

    Please help?
     
  9. Gray_Master

    Gray_Master

    Joined:
    Jun 20, 2010
    Posts:
    140
    I find on GitHub PBR version of SSE, This modifycation is fully working on unity 5.5. Download from there .
     
    Alverik likes this.
  10. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,180
    Well i'll be damned o_O
     
  11. sledgeman

    sledgeman

    Joined:
    Jun 23, 2014
    Posts:
    323
    @MadMax2007...thank you so much for the link to the PBR version of SSE ("kou-yeung/SSE" LINK) ! It works perfect with my U5.37 version ! Somehow the GitHub "stramit/SSE" doesn´t work well. It has bugs like: - generates spheres when hiting preview & - textures disaper every time you close SSE, so you have to reassign textures.

    Now i would say, the "kou-yeung/SSE" (LINK) version is a very good free / open sorce shader editor for Unity5 !
     
    Alverik likes this.
  12. Gray_Master

    Gray_Master

    Joined:
    Jun 20, 2010
    Posts:
    140
    Use for Health )))
     
  13. Nate6

    Nate6

    Joined:
    Mar 10, 2017
    Posts:
    1
    Hey guys, so I know I getting to this late but is there a version of strumpy that will work in current Unity (5.5.0f3)?
     
    Zehru likes this.
  14. ScottJ88

    ScottJ88

    Joined:
    Aug 28, 2012
    Posts:
    47
    Hi all, I am still using strumpy shader editor, creating a super basic shader (or at least trying to) its an unusual case to say the least, but bare with me on it. to put it simply though my shader / coding skills are not too good and thus why I am using SSE (plus using an old version of unity still)

    so here is what I am trying to do.
    have 2 input textures - multiply them together and then based on this multiply, if ANY pixel is anything but black (I am only using black and white textures anyway) then the entire shader goes white, everything I have tried thus far does this to each pixel and returns each pixel as white or black, not the entire thing. really don't know if this is possible, but I am hoping so and equally hoping that someone can help out here.

    Code (CSharp):
    1. float4 Tex2D0=tex2D(_Diffuse,(IN.uv_Diffuse.xyxy).xy);
    2. float4 Tex2D1=tex2D(_Collision,(IN.uv_Collision.xyxy).xy);
    3. float4 Multiply0=Tex2D0 * Tex2D1;
    4.  
    5. //some code here to set all pixels to white if any pixel in Multiply0 is >0
    6.  
    7. float4 Master0_1_NoInput = float4(0,0,1,1);
    8. float4 Master0_2_NoInput = float4(0,0,0,0);
    9. float4 Master0_3_NoInput = float4(0,0,0,0);
    10. float4 Master0_4_NoInput = float4(0,0,0,0);
    11. float4 Master0_5_NoInput = float4(1,1,1,1);
    12. float4 Master0_7_NoInput = float4(0,0,0,0);
    13. float4 Master0_6_NoInput = float4(1,1,1,1);
    14. o.Albedo = Multiply0;
    thanks!
     
  15. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    340
    I don't think that's possible, unfortunately.

    Pixel shaders don't ever operate on an entire texture like that. Pixel shader code runs once per frame per pixel and only affects the color of that pixel. The first two lines look up the color of the textures based on the coordinates of the surface under the current pixel. To find out the color of the textures in other places, you'll need more tex2d() calls. To be certain both textures were entirely black you'd have to look up every pixel in both textures. You could do it in a loop, I suppose, but that would be very slow, and I doubt SSE supports loops.

    A better solution would be to go pixel-by-pixel through the two textures in a script. For each pixel, multiply them together. If it's anything but zero, set the material color to white and exit the loop. If you make it all the way to the end without finding anything but zero, set the material color to black. You still have to look up every pixel of the material, but instead of doing it once per pixel per frame on the GPU (basically impossible) you do it on the CPU whenever the textures change.
     
  16. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    408
    I can't remember if Strumpy has mip support, but an easy way might be to check that a higher mip (like mip8 or 9) is black. If the texture has mip map and they're filtered, it'll act like a blur and even one white pixel should mode it ever so slightly away from black.
     
  17. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    340
    If the textures were already multiplied that might work for the "Is any pixel white" check. (You might still run into rounding errors on larger textures w/ only a few white pixels I think.)

    Unfortunately, what he needs (and I really wonder what this code's trying to do) is to check if any pixel is white in both textures.
     
  18. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    408
    Yeah, you'd have to check the mips for both textures.

    For any other math, there should be a way to check for 0. Presumably, even with floating point calculations, you still have a maximum number you can deal with, and therefore a maximum exponent before things get out of whack, which if everything is 0 they shouldn't (hey, free but hideous check right there).
     
  19. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    340
    Are mip-maps stored as true floating point averages? If they are there shouldn't be rounding errors, but I think they're precomputed and stored in whatever the original texture format is, which probably only has 256 levels.

    Sampling a tiny mip-map and then multiplying the samples is not the same as multiplying the textures and then sampling a tiny mip-map of the multiplied texture though.

    Take these textures:
    upload_2017-5-25_10-12-52.png
    If you follow his procedure and multiply the textures and then check for non-black pixels you won't find any. There are no shared non-black pixels. The result will be black.

    If you sample the lowest mip level of each texture, they'll both be slightly off-black. After multiplying them they'll still be slightly off-black. The result will be white.
     
  20. ScottJ88

    ScottJ88

    Joined:
    Aug 28, 2012
    Posts:
    47
    I would like to say thank you all for your input, some interesting points here, brisingre is correct in what I need - it would be the mip map of the computed output for the multiplied texture.

    The idea behind this was to possibly do a gpu based zone trigger.
    A bit like a 2Dpolygon collider with trigger, but doesn't require much (if any) cpu time
    have the 1st texture as the trigger zones and then the second smaller texture the shape of the character, that is clamped tiled and then offset in the X,Y each frame to update its relative real world location.

    if the character went into the zone then the entire material would go white, and do a simple texture/material test on the color (originally was thinking get pixel but wouldn't work because as far as I am aware this is only for a texture - not a shader, so place it on an unlit plane and just test the color at any given point)

    with all of it white, or a set pixel white I would then know if it was in or out of the zones - my thought as gpu's are designed to handle massive parallel data sets like texture multiplication quickly, this may be an alternative to multiple physics objects and triggers - essentially I could turn of the physics engine at that point, but as usual looks like things are not as simple as I would of liked!
     
  21. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    340
    That makes sense. Unfortunately it's never easy doing gameplay calculations in a shader. Doing the calculations themselves is pretty easy as long as they parallelize well (i.e. nothing where every pixel needs to know about every other pixel). Getting the information you need in and out is harder. In isn't usually too bad, you just write a script to feed in the variables you need, but out's genuinely pretty rough. You usually need to set something up to send your results to a RenderTexture and then use getPixel or something to get information from it every frame. It ends up being a pretty complicated system, and unless you implement it in a clever way to minimize the number of times you have to call getpixel every frame it's also pretty slow.

    This is for surface shaders and pixel shaders, which are (more or less) restricted to running once per pixel of a camera every frame and out outputting a color. Compute shaders can run whenever you like and output whatever you like. They exist for the explicit purpose of letting you write specialized code that runs on the GPU and I'm sure one could be written to do 2D collision. Unfortunately, they're a pretty new feature without a lot of documentation. SSE definitely does not support writing them. https://docs.unity3d.com/Manual/ComputeShaders.html

    Are you doing something that the built-in 2D collisions are too slow for? Do you just need pixel-perfect collisions? This could be a starting point: https://timeshapers.com/2014/05/09/pixel-perfect-collision-in-unity-2d/
     
  22. ScottJ88

    ScottJ88

    Joined:
    Aug 28, 2012
    Posts:
    47
    So its not extremely slow, however my game will become cpu bound (city builder) and I looking into freeing up as much cpu as I could, plus I had some issues when I upgraded from 3.5 to 5.6 with the physx - removing support for non convex collision triggers. I was using a collision mesh to follow specific areas that totaled 40k tri's over 60 zones and even then that wasn't perfect.
    So while I was looking into fixing that issue I came back to this idea I had a long time ago, though as this was harder than I thought I looked into other fixes and solved the original issue.
    still, the info you provided is interesting indeed, if I get more spare time I might look into this a bit more.
     
  23. brisingre

    brisingre

    Joined:
    Nov 8, 2009
    Posts:
    340
    That makes sense. Glad you got it figured out.
     
    Last edited: May 28, 2017
  24. PedroDuran

    PedroDuran

    Joined:
    Aug 19, 2014
    Posts:
    22
    Hi ! i'm trying your shader editor and it's not working in unity 5.6.1 :/

    When i open the shader editor:

    Captura1.PNG
     
  25. DimaFedotov

    DimaFedotov

    Joined:
    Jun 22, 2017
    Posts:
    4
    Please, can someone help me? I can not export the shader. When i press the export button, the menu disappears for a second and then appears again. At the same time, nothing is exported.