Search Unity

Shader Forge - A visual, node-based shader editor

Discussion in 'Assets and Asset Store' started by Acegikmo, Jan 11, 2014.

  1. DeveloperRLA

    DeveloperRLA

    Joined:
    Jun 17, 2013
    Posts:
    53
    Is it possible to use shader forge to create a shader that can have a custom lightmap baked from an external tool? Similar to the legacy lightmap shaders? If so, anyone have any ideas how to create it?
     
  2. dranelol

    dranelol

    Joined:
    Jan 24, 2014
    Posts:
    5
    Hey guys, I just got started working with shaders, and decided to check this tool out. I've made a few simple shaders on my own, and reproduced a few effects I've found in this thread.

    I'd like to get a little more complicated, and re-create a black-hole like gravitational lensing effect, almost exactly what was created in UDK in this thread on Polycount, with this as the desired effect.

    I have almost no clue where to start with this one, could anyone help out, or at least push me in the right direction?

    I would appreciate any help.
     
  3. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Yep! The shader itself simply need to read the lightmap texture, probably with UV channel 1 rather than 0, and then you add that to your lighting calcs, leading to your custom lighting input.

    Well, the threads you linked has quite a few examples already, you should be able to translate the UDK nodes to SF nodes
     
  4. BuildABurgerBurg

    BuildABurgerBurg

    Joined:
    Nov 5, 2012
    Posts:
    566
    Does shaderforge work with Unity 5 gradient ambient lighting?

    Thanks
     
    Murgilod likes this.
  5. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Yes. The latest version will look oversaturated on non-uniformly scaled objects though, but this is already fixed in the coming version
     
    Murgilod likes this.
  6. BuildABurgerBurg

    BuildABurgerBurg

    Joined:
    Nov 5, 2012
    Posts:
    566
    would you give me an example?

    is there a gradient lighting option added? node?
     
    Murgilod likes this.
  7. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    The "gradient lighting" is automatically applied if you make your shader support spherical harmonics / light probes :)
     
    Murgilod likes this.
  8. twoc46

    twoc46

    Joined:
    Jul 10, 2012
    Posts:
    7
    I would love a tutorial or a push into the right direction to create something like this any help would be awesome.
     
  9. dranelol

    dranelol

    Joined:
    Jan 24, 2014
    Posts:
    5
    Yea, I tried a few times doing that, but a few of the pictures in the thread are just too small to decipher which nodes they were using for certain things. Also, it seems a few functions are different between the two systems, mainly plugging UV coords into a subtract node: In UDK, this seems to tile the UV coords, but in SF, it seems to clamp at 0. Maybe I'm wrong?

    Also, a question that I had from trying to recreate that: a few times, they used a texture and simply applied the distortion to THAT texture, and then applied the material to an object. Later on, they converted the shader to seemingly work as a refraction(distortion?) shader, that just distorts anything behind the object. How to do that conversion is probably the biggest part where I'm stuck.
     
  10. toxtronyx

    toxtronyx

    Joined:
    Aug 21, 2014
    Posts:
    114
    Good point. Any hint how to enable Reflection probes?

    TIA
     
  11. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,160
    I can give you the general starting point I used.

    http://armedunity.com/topic/5669-pro-only-how-to-make-custom-image-effects/

    I used this explanation of how to pass image effects to a shader in Unity, however, instead of material.SetFloat, I used material.SetTexture and pointed it at the name of the texture I'm applying the effect to in Shader Forge. From there, you can basically just make your shader like any other you would.
     
    twoc46 likes this.
  12. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    The behavior is the same between UDK and Unity - you probably just set your texture import settings to clamp rather than wrap :)

    Refraction is essentially about offsetting UV coordinates before sampling a texture, whether it's the scene background texture or another texture in the shader.
     
  13. Jesus

    Jesus

    Joined:
    Jul 12, 2010
    Posts:
    504
    Just submitted a shader pack on the asset store!
    The shaders in this pack (all of them) are compatible with shader forge, hence me posting about it here. It's the first in a series of 10 packs; each with a bunch of small but useful shaders that you might use making a game.
    Here's a screenshot of the first one!


    Check out the thread here for more info:
    http://forum.unity3d.com/threads/utility-shaders.280098/
     
  14. RUBILYN

    RUBILYN

    Joined:
    Jun 22, 2013
    Posts:
    54

    DEAR ACEGIKMO !

    Thanks so much for Adding the Missing Links to Enable us to Build Relief Shaders with SHaderforge !

    And thanks so much For all Newest Features Already Implemented !
    They Reaaly Make SHaderforge Indispensable in any Shader Development pipeline !


    Taken from Latest changelog : http://acegikmo.com/shaderforge/changelog/

    New in Shader Forge RC 0.37 / 1.0? : (Unreleased)
    • Added node: Object Scale (Unity 5+ only)
    • Added node: Fog Color
    • Added node: DDX
    • Added node: DDY
    • The node flow is now from left-to-right instead of right-to-left
    • You can now make shaders support Unity 5's reflection probes
    • You can now set per-node variable precision to either Float, Half or Fixed
    • You can now plug in Diffuse Ambient Occlusion into the main node
    • You can now plug in Specular Ambient Occlusion into the main node
    • You can now manually set the internal name of properties
    • You can now optionally disable the right-hand side node browser
    • The depth node now has a preview icon & data
    • Optimized the editor performance of the node tree - especially when you have lots of nodes
    • Fixed minor issues with spacing and UVs unnecessarily declaring variables in the generated code
    • Fixed a bug in Unity 5 where fog didn't work at all
    • Fixed a bug in Unity 5 where light probes oversaturated on scaled objects
    • Fixed a bug where the interface disappeared when pressing return on certain nodes
    • Fixed a bug where you couldn't use copy/paste/cut in the code node
    • Fixed a bug where pressing delete with a text field selected, deleted selected nodes instead of a character
    • Fixed a bug in the toggle node and the normal direction node, where they had incorrect default values on load
    • 20 nodes that unnecessarily defined variables, no longer do so​

    I love Expecially the Unity 5 Compatibility !
    ANd the Large Numbers of nodes .. And the DDX / DDY for Relief ! Is already Super Dupper Amazing !!


    I think thats it ! The Dream Shader Maker is now Cometrue for me ! WIth this last Latest features !
    The last Thing on My "Dream Wishlist" Out of Shaderforge would be Procedural Volumetrical Shaders !

    WOuld be a Dream cometrue if someday SHaderforge Allow us to Make Procedural Volume Shaders like this :
    https://www.shadertoy.com/view/XsX3RB#


    Anyway !
    But there is Cool Extras on that List Already !

    1) We can Have Unity 5 Reflection Probes ...
    2) Assign Float Half Fixed, That Ubber Optimizes Mobiles Shaders right ...
    3) The Object Scale to Adapt SHaders Features to Look good no matter Object Size
    ...

    - Having Diffuse/Specular Ambient Occlusion is amazing Greath to make Proper Phisical based Shaders that Have Severall Layers of MicroOcclusion but Respect IBL Lightning ! Thanks !!​

    But there is a Few Questions i have on those Implemented Features :


    1) How Shaderforge works in Conjunction with Unity 5 ( Standart SHader ) Technically ??

    2) Is Shaderforge able now to do "mimic" and completly reproduce the "Unity 5 Standart SHader" in Specular & Metalicy Modes Introduced in Beta13 ?

    3) Will SHaderforge Use the Standart Shader as default ?
    - And how about the Fact that Unity 5 STandart Shader "Merges the bitmap channels" ?

    4) WIll Shaderforge keep Having its own "diferent" Phisical based Model ?

    If Possible we would really Like to Have Both ! :)

    5) And How About Unity 5 Standart SHader Static MultiCompiles ? How is that Going ?
    It will be on SHaderforge 1 Cicle or can we just expect those in SHaderforge 2 ?

    Thanks SO much for your time!

    DEar AceGikmo thanks so much for Listening and applying our Requests ... you are AMAZING !!!
    - But hey ! Its Already Almost 5 months that we dont have Updates !! lolol sorry ...
    But After so many months we are Getting Crazy To get With the New Implemented features ! Wyyyyy....
    I guess we all ... Must .. be .. Patient :p

    - - ANd OK ! ... i Understand that you want to have a Refined Asset to Have in STore ...

    - But Can We Customers Please Have Again ACCESS to WEEKLY BUILDS ! Pleasee....

    - And Please Somehow Go Back to the Shaderforge "Alpha" Beginnings Internal Customers weekly/monthly Release scheme were we could have access to Alpha Builds Independent from Assets Store ?

    ... I say that Also Because the Assets Store is Quite Broken .. we cant even Acess Shaderforge 0.36 !
    As it Says its 0.36 but then only downloads 0.35 ... Its some problem in the Assets store cache ...
    ...

    Would be Seriously Reaaly Amazing for all us if we could have Access Again to Weecly Builds ...

    1) Would not Stress you out to Release More Refined Things at the Store ...

    2) We all would be happy to have all latest weekly/monthly Features to work with ..

    3) WOuld be better for you / to have More Feedback / And help to debug those new features as you code it ...

    So Ends up in More For us And less work for you ..​

    :D

    Please Just Think About it !

    A Weekly Updated Development Repository that we customers have acess ! Would be Amazing !
    Especially in this Unity 5 Unstable Development Cycle / and New Entire Rewrite ...​

    THANK YOU SO MUCH FOR YOUR SO MUCH TALENTED AMAZING WOUNDERFULNESS !

    And Thank you so much for Listen to your customers so actively !


    Kyoko.
     
    Last edited: Nov 16, 2014
  15. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,160
    Is the object scale node based on xyz, or is it the same as returning unity_Scale.w in the code node? Because if Unity will have proper xyz scale data in Unity 5 that'll be amazing
     
  16. IFL

    IFL

    Joined:
    Apr 13, 2013
    Posts:
    408
    @Acegikmo would you be comfortable giving a loose time-frame for the v2 release? If not, no worries.
     
  17. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    https://twitter.com/JoachimHolmer/status/530370161812193280

    2.0 is quite far. Months - at the very least 4 months, I would guess. 1.0 / next version is coming along nicely though, and should be done in about a week or two :)
     
  18. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Glad you like the upcoming stuff :)

    It will use the same PBR BRDF shading functionality, it's just like setting the lighting mode to PBL.

    It should do that in the next version yes :)

    Not sure if it'l be default or not, but it'll be available. Not sure what you mean by the bitmap merge part though.

    Probably not. Why do you need the old one?

    This is impossible in SF1, and has to go into SF2
     
  19. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,160
    This is fantastic! I've been doing similar with init scripts and some editor preview scripts so having something built in will save me so much time!
     
  20. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Hey Ace, you bring good news! :)

    I'm just wondering, the real-time area lights you mentioned in Unite 2014, are they going to be in SF1.0 or SF 2.0

     
  21. isyourguy

    isyourguy

    Joined:
    Nov 17, 2014
    Posts:
    2
    Hey everyone!

    I've been mucking about with Shaderforge a lot lately. It's such a great tool! Thanks a bunch Ace!

    Now, some questions. I'm having trouble trying to get a specific effect. I'm hoping to be able to use lighting as a mask of sorts and reveal a different texture/alpha as lighting passes over the material. I've attached what I've got so far but it's pretty broken and unoptimised. I guess I've got two questions.

    1. My colour is being added a bunch of times resulting in very bright areas. I think this makes sense, but is there any way to prevent it?
    2. Currently stuck using alpha since even though I know I should be using alpha clip, I can't really get it working.

    Added my node graph and a gif of the material as a light source moves over it. I get the feeling I'm going about this the wrong way but I'm struggling to think of another approach. Any ideas?
     
  22. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Maybe 1.0, definitely in 2.0!
    The version I showed there was sort-of implemented in SF already, it's just that it was quite unintuitive to work with, and it broke support for any other light sources than rectangular area lights for those specific shaders. I want to make it properly implemented and sleek for the user

    Glad you like it!
    So, this is a tricky one, due to how forward rendering works.
    It renders the first light source as you expect, but then it runs another version of your shader per-light-source, additively, and renders it on top. Not sure if there's away of doing it, except simply making it only support a single light source
     
  23. isyourguy

    isyourguy

    Joined:
    Nov 17, 2014
    Posts:
    2
    Ah of course it is! That makes sense. I should've guessed as much. Single light source isn't an option. Might have to keep experimenting, see if I can find a sneaky way of doing it. Thanks!
     
  24. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    @Ace

    Nice ! I saw the youtube video but couldn't find any documentation on it. Is there an online source that explains how to use the area light reflections in the current unity build ?
     
  25. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    It's not in the latest release build, I just have it locally
     
  26. RUBILYN

    RUBILYN

    Joined:
    Jun 22, 2013
    Posts:
    54
    Hey ! As we are talking about "Area Lights" and the subject touches a litle bit "Area Shadows" ...

    Here is a SHader That does Analitical antialiasing for raytraced Geometry ...
    "Only one ray/sample per pixel is casted. This shader also uses analytical ambient occlusion and analytical soft shadows."

    https://www.shadertoy.com/view/MsSSWV



    That Ambient Oclusion & Soft Shadows Per Shader ...
    IS something out of this world greath XD

    WOULD LOVE To See a "Compute Shader" Code Node in ShaderForge ...
    Now that UNITY 5 Gets full support to compute shaders, at least already there in dx11 ...

    http://docs.unity3d.com/Manual/ComputeShaders.html

    How wounderfull would be To just copy Paste in a code node ! All Craziness there is in ShaderToy.com ...
    And inputs and functions be aplied to our Shaderforge shaders ... ^^

    That Kind of Future that Unity 5 will allow would be wounderfull to be integrated in shaderforge one day someway ...

     
  27. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,160
    It's important to note that unless Unity 5 expands OpenGL support, especially on OSX, that's really not going to mean much.
     
  28. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    422
    Ok, so I'll admit up front I feel a little silly asking this question as the answer is most likely right in front of me... but it is eluding me. :)

    I want to create a shader that will allow a 2D image to have a ripple effect. Essentially, a sine wave on the pixels of a 2D image. Back in the days of coding shaders in HLSL by hand, I would just program something to use a sine wave to offset each row of pixels along the Y coordinate based on the delta time. Basically something like this (using some pseudocode):

    texture.coordinate.y = (Sine + DeltaTime) * speed

    In Shader Forge, I can easily figure out how to do that - but only on the UV for the entire texture. So rather than having each row of pixels offset and animate, the entire image as one block moves as a whole. The following image shows the shader for that.



    So my question is - in Shader Forge - how do I modify pixels row by row?

    Thanks in advance!
     
  29. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,160
    It's actually fairly simple. In this image I'm using here, I'm just panning a vertical gradient texture in node_34, then using the R value as the distance in the panner affecting node_2:



    There are ways to procedurally generate a moving gradient that you can use for more fine control, but this is more for speed and example rather than full precision.
     
  30. RedVonix

    RedVonix

    Joined:
    Dec 13, 2011
    Posts:
    422
    This is exactly what I needed, thank you very much! One question... if I wanted to make sure that the texture did not scroll, how would I manage that?
     
  31. bringclose

    bringclose

    Joined:
    Nov 20, 2014
    Posts:
    7
    Hi all,

    I see the water scene below very cool. So could you please share me a solution to make it?

    i am trying to use "cloud shared by (@metlapig)", but how to blend it on map behind?



    Thanks so much :)
     
    Last edited: Nov 20, 2014
  32. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
  33. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    I'm trying to make a refractive effect, where the "pole" is distorted under the water (which looks perfect) but around the edges of the parts that are above water it's giving strange results, as if those parts are underwater too, but clearly it isn't. Is there a way to fix this?


    Screen Shot 2014-11-20 at 12.20.07 AM.png
     
  34. the_motionblur

    the_motionblur

    Joined:
    Mar 4, 2008
    Posts:
    1,774
    I don't thinks so. I've noticed this effect in all the other games using a similar effect as well. Not just Unity. I actually have yet to see a game where this isn't the case.
     
  35. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    DMeville likes this.
  36. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Damn. That's what I kind of thought.
    Found this too: https://shaderforge.userecho.com/topic/456558-refraction-mask/ so I guess that answers the question. hmm.
     
  37. Cactus_on_Fire

    Cactus_on_Fire

    Joined:
    Aug 12, 2014
    Posts:
    675
    Yeah that's a common problem for most games that use refractive shaders. Even the example scene that came with SF had that problem, so I'm not sure if there's a solution for it.
     
    DMeville likes this.
  38. RUBILYN

    RUBILYN

    Joined:
    Jun 22, 2013
    Posts:
    54
    Hi Dear AceGikmo !

    Thank you so much for taking some time to answer.

    And im sorry to Bug you out with my Usual Crazy ideas ...

    But i got here just 2 more Questions / Ideas ...

    1) About that thing we talked like 7 months ago into "Converting & Group Nodes into Code" ?


    Is that possible, is easy , feaseble, could be in v1 or v2 ?

    2) About the Multicompiles ...

    I have here a very cool Idea ...
    Multicompiles in SHader Code just got this Few Codes ( as in the example bellow ) Right ?

    - #pragma multi_compile BUMP_OFF BUMP_ON
    - #ifdef BUMP_ON
    - #endif
    Then we just need to have a custom Cs with ( public class MulticompTest : MaterialEditor )

    ANd i think that is the Hardest part ... The Custom cs Code ...
    BUT Would be possible ( or More Easy ) to Just Have a Way to Have in Shaderforge Editor
    A way To Add The ( #ifdef BUMP_ON / #endif ) TAG To A Bunch of Selected Nodes ...

    This could be done Like In 2 Ways

    1 - Selecting Severall nodes and add a Square box around them :
    - Then in that Square box We could add Any tipe of Tags / or Comments we want ...
    - Then Those Tags / comments - WOuld appear IN ALL Nodes In the Code ..

    2 - Add Individually a Comment "Before & After" to Each Node - Or Each Node group...
    This way we could Add the ( #ifdef BUMP_ON ) Before and ( / #endif ) AFter on all Nodes We want ...

    Then would be Just for us to Deal with the custom Cs with ( public class MulticompTest : MaterialEditor ) ...
    PS: Someone could even do a External "Multicompile cs Code maker" for example ... ...
    I Have a Example of a Simple Single Multicompile Bellow ...

    You See would be QUITE EASY To do it this way ...
    Its so simple that this "Coments before and after each node/s" Could be even in next versions ... ?

    WHAT YOU THINK ?

    THANKS FOR LISTEN !

    Thanks So million Much !

    Kyo Chun
    KYON Games
    A3D Studios
     
    Last edited: Nov 21, 2014
  39. RUBILYN

    RUBILYN

    Joined:
    Jun 22, 2013
    Posts:
    54
    PS: HEY WOUNDERFULL PEOPLE ! LISTEN !!
    I GOT DEEP / AND GOT WOUNDERFULL NEWS !

    On the Case of MultiCompiles !
    If its just with "Togles" and "Drop Downs" There is no need to Build a CustomInspector.cs at all !

    This fact might Easy things / on the Custom Code SHaderForge needs to output !
    Hopefully Allowing Shaderforge to Use Multicompile Variants a lot Sooner !

    CHECK IT OUT !

    We Can Actually use "MaterialPropertyDrawers" That Set "Shader Conditional Keywords" !
    Directly Just in the Shader code like this !

    Code (CSharp):
    1.  
    2. // Shader Inspector Conditional Toggle
    3. [Toggle(ENABLE_ON)] _EnableFancy ("Fancy?", Float) = 0
    4.  
    5. // Shader Inspector Conditional DropDowns
    6. [KeywordEnum(None, Add, Multiply)] _Overlay ("Overlay mode", Float) = 0
    7.  
    8. ....
    9.  
    10. // ... in CGPROGRAM Conditional code:
    11. #pragma multi_compile _OVERLAY_NONE, _OVERLAY_ADD, _OVERLAY_MULTIPLY
    12.  
    13. ....
    14.  
    15. // In Shader code Individual conditions for each part of the code ...
    16.  
    17.   #ifdef ENABLE_ON
    18.     // Nodes code here
    19.   #endif
    20.  
    21.   #ifdef _OVERLAY_NONE
    22.     // Node code here
    23.  #endif
    24.  
    25.   #ifdef _OVERLAY_NONE
    26.     // Node code here
    27.  #endif
    28.  
    29.   #ifdef _OVERLAY_ADD
    30.     // Node code here
    31.  #endif
    32.  
    33.   #ifdef _OVERLAY_MULTIPLY
    34.     // Node code here
    35.  #endif
    36.  
    37.  
    38. ...
    Unity Oficial reference :
    http://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html


    Well thats it for Today challenge !

    HAVE FUN !
    THANK YOU !

     
    Last edited: Nov 21, 2014
  40. Marco-Sperling

    Marco-Sperling

    Joined:
    Mar 5, 2012
    Posts:
    620
    Have a look at the Water4Pro shader. They grab the framebuffer (_RefractionTex) which contains all objects - those behind the water plane and those in front of the water plane because Water is transparent and will be rendered after opaque objects.
    In the shader they measure the depth of the pixels in the framebuffer - those pixels that lie behind the depth of the waterplane get distorted. Those that are infront use the undistorted _RefractionTex.
    Essentially the depth is used as a mask - and the _RefractionTex gets sampled twice per pixel. One time with distortion, one time without.
     
    DMeville likes this.
  41. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Ohh, thanks for the tip. I'll have to dig into this a bit and take a look. I'm a shader noob still when it comes to actually looking at the code but I could probably make sense of it, and I'd love to use an effect like this in a 3d project I'm working on.

    We were using this effect on a 2d game, and had everything set up in layers, so we actually knew the order things should render in. We fixed this refraction problem by rearrainging some texture atlases to contain only elements behind in separate atlases. Then with the help of the set Render Queue script here (http://wiki.unity3d.com/index.php?title=SetRenderQueue) we just manually ordered the drawing. Now it looks great and is only distorting objects "behind" the glass. :)
     
  42. DaDarkDragon

    DaDarkDragon

    Joined:
    Jun 6, 2013
    Posts:
    115
  43. DaimDG

    DaimDG

    Joined:
    Nov 23, 2014
    Posts:
    5
    Hi! How do I get the border between the pieces texture painted in a different color?


    About what I want to get:
     
  44. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Sample the texture multiple times with slightly off UV coordinates, and see if they are different or not
     
  45. chargedneuron

    chargedneuron

    Joined:
    Jan 12, 2013
    Posts:
    21
    I've seen it asked a few times but I haven't found an answer that tells me much. I am trying to replace the Unity Standard Asset Projector shader with one from SF. I am trying to make a SF shader that works with a Unity Projector to project a "Targeting Ring" around the NPC I have selected upon the terrain/objects. I have attached a screen shot from my earlier version. Note the Green Ring around the NPC, that's what I want a SF Shader for.

    My thanks in advance for any assistance - ChargedNeuron

     
    Last edited: Nov 23, 2014
  46. Ashinokami

    Ashinokami

    Joined:
    Oct 10, 2014
    Posts:
    3
    Hi all, I have a different refraction problem:
    refraction bug.png
    The objects behind water plane get distorted, but their unshaded 'contours' stay in place. All shaders here are made with SF and are Alpha-Blended. I used water shader's diffuse component for depth-based colouring, and alpha value is also depth-blended. So I guess refraction effect cannot distort diffuse part. Here's better view:
    Untitled.png
    Thanks!
     
  47. DaimDG

    DaimDG

    Joined:
    Nov 23, 2014
    Posts:
    5
    Yes, it works, thank you! But I got a strong line...

    how do I make it softer, as in the screenshot in my previous post?
     
  48. Acegikmo

    Acegikmo

    Joined:
    Jun 23, 2011
    Posts:
    1,294
    Softer as in, less contrast? Multiply it by 0.5 or so.
    Softer as in, less pixelation? Sample in 8 directions instead of 4.
     
  49. PrawnJeremy

    PrawnJeremy

    Joined:
    Aug 20, 2013
    Posts:
    35
    Hi, I was wondering how to go about making effects based on geometry that is occluded by other geometry. For example in this image, the part of the character below the water is shaded differently. In the game the same effect can be seen when the player walks behind a wall so you can still see the character.

     
  50. PrawnJeremy

    PrawnJeremy

    Joined:
    Aug 20, 2013
    Posts:
    35
    A second question, how would you setup a custom lighting shader that casts shadows but disables self shadowing, so it casts shadows but not on the object it is attached to? Note: I can't simply deselect Receives Shadows because I need it to receive shadows from other objects, just not itself.

    Thanks for any help, trying to nail down the direction for shadows in my game... would like to use real time shadows instead of projectors but would need to figure out how to resolve some issues.