Rimlight | Customizable rimlight shader for Unity | Game Engine library

 by   AdultLink C# Version: v0.1 License: MIT

kandi X-RAY | Rimlight Summary

kandi X-RAY | Rimlight Summary

Rimlight is a C# library typically used in Gaming, Game Engine, Unity applications. Rimlight has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

Rim lighting is a light that usually comes from beside or behind a subject, and enhances its silhouette. This shader fakes this by making use of the Fresnel effect. This can be used to stylize or highlight objects, and it greatly favors certain artstyles. It is especially pleasing when applied to smooth curvy models.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              Rimlight has a low active ecosystem.
              It has 176 star(s) with 31 fork(s). There are 13 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              Rimlight has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of Rimlight is v0.1

            kandi-Quality Quality

              Rimlight has no bugs reported.

            kandi-Security Security

              Rimlight has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              Rimlight is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              Rimlight releases are available to install and integrate.
              Installation instructions are available. Examples and code snippets are not available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Rimlight
            Get all kandi verified functions for this library.

            Rimlight Key Features

            No Key Features are available at this moment for Rimlight.

            Rimlight Examples and Code Snippets

            No Code Snippets are available at this moment for Rimlight.

            Community Discussions

            QUESTION

            How to fix CMake file provided by the OpenGL Superbible 6th edition book
            Asked 2019-Apr-23 at 08:05

            I'm having problems compiling the example code provided with the OpenGL Superbible, 6th ed. I'm using Ubuntu 19.04 and CMake 3.13.4. I have all the necessary dependencies. CMake executes with no problems ("cmake ."), but when I enter the make command it fails.

            I'm under the impression it has to do with GLFW but I don't know how to change CMake for it to work.

            Here's a link to the example code. https://github.com/openglsuperbible/sb6code

            I've already fixed the issue in line 13 of the CMakeLists.txt file but its still not compiling.

            From:

            ...

            ANSWER

            Answered 2019-Apr-23 at 08:05

            I have changed the code and the cmake file to work with GLFW3. Now the project compiles and runs. I uploaded it to github here: https://github.com/mlioz/sb6code_fixed

            Source https://stackoverflow.com/questions/55634364

            QUESTION

            Shader ZTest not behaving as expected
            Asked 2018-Jun-11 at 12:29
            Shader "Custom/Selected Object" {
                Properties {
                    _Color ("Color", Color) = (1,1,1,1)
                    _MainTex ("Albedo (RGB)", 2D) = "white" {}
                    _Emission ("EmissionColor", Color) = (0.5, 0.5, 0.5, 1)
                    _Glossiness ("Smoothness", Range(0,1)) = 0.5
                    _Metallic ("Metallic", Range(0,1)) = 0.0
            
                    _Mode ("Blend Mode", Range(0,3)) = 0
                    _ZWrite ("ZWrite", Int) = 0
                    _SrcBlend ("SrcBlend", Int) = 0
                    _DstBlend ("DstBlend", Int) = 0
            
                    _Cutoff ("Alpha Cutoff", Float) = 0.05
                }
                SubShader{
                    //Behind other geometry
                    Pass
                    {
                        ZTest GEqual
                        ZWrite [_ZWrite]
                        Blend [_SrcBlend] [_DstBlend]
            
                        CGPROGRAM
                        #pragma vertex vert
                        #pragma fragment frag
            
                        #include "UnityCG.cginc"
            
                        struct appdata 
                        {
                            float2 uv : TEXCOORD0;
                            float4 vertex : POSITION;
                            float3 normal : NORMAL;
                        };
            
                        struct v2f
                        {
                            float4 pos : SV_POSITION;
                            float3 viewDir : TEXCOORD1;
                            float3 normal : NORMAL;
                            float2 uv : TEXCOORD0;
                        };
            
                        v2f vert(appdata v)
                        {
                            v2f o;
                            o.pos = UnityObjectToClipPos(v.vertex);
                            o.normal = UnityObjectToWorldNormal(v.normal);
                            o.viewDir = normalize(UnityWorldSpaceViewDir(o.pos));
            
                            o.uv = v.uv;
                            return o;
                        }
            
                        sampler2D _MainTex;
            
                        fixed4 frag(v2f i) : SV_Target
                        {
                            //Note you have to normalize these again since they are being interpolated between vertices
                            float rim = 1 - dot(normalize(i.normal), normalize(i.viewDir));
                            fixed4 rimLight = lerp(half4(.95, .95, .95, 1), half4(0.65, 0.65, .95, 1), rim);
                            fixed4 t = tex2D(_MainTex, i.uv);
                            clip(t.a < 0.2);
                            return t * rimLight;
                        }
            
                        ENDCG
                    }
            
                    ZTest Less
                    ZWrite On
                    Blend [_SrcBlend][_DstBlend]
            
                    //Front geometry
                    CGPROGRAM
                    // Physically based Standard lighting model, and enable shadows on all light types
                    // And generate the shadow pass with instancing support
                    #pragma surface surf Standard fullforwardshadows addshadow alphatest:_Cutoff //alpha:blend //keepalpha
                    // Use shader model 3.0 target, to get nicer looking lighting
                    #pragma target 3.0
            
                    #pragma multi_compile __ EMISSIVE_ON
            
                    sampler2D _MainTex;
                    fixed4 _Emission;
                    fixed4 _Color;
                    //float _Mode;
            
                    struct Input {
                        float2 uv_MainTex;
                    };
            
                    half _Glossiness;
                    half _Metallic;
            
                    void surf(Input IN, inout SurfaceOutputStandard o) {
                        // Albedo comes from a texture tinted by color
                        fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
                        o.Albedo = c.rgb;
                        #if EMISSIVE_ON //Glowing
                            o.Emission = _Emission;
                        #endif
                        // Metallic and smoothness come from slider variables
                        o.Metallic = _Metallic;
                        o.Smoothness = _Glossiness;
                        o.Alpha = c.a;
                    }
            
                    ENDCG
                }
                FallBack "Instanced/InstancedSurfaceShader"
            }
            
            ...

            ANSWER

            Answered 2018-Jun-11 at 12:29

            Before answering the actual issue here I need to point out this:

            If you have more than two passes for multi-pass Shaders, only the first passes can be instanced. This is because Unity forces the later passes to be rendered together for each object, forcing Material changes.

            https://docs.unity3d.com/Manual/GPUInstancing.html

            So in essence, with your current implementation using Passes, you won't be able to use GPU instancing anyway.

            now, the problem with your shader is that all your passes are opaque, so there is no guarantee in the draw order of the meshes. If the occluders are rendered after the occludee, there won't be any information in the Zbuffer to test against. The solution is simply to increase the render order of the material, for it the be drawn right after all other opaque (ZWrite On) pixels.

            Source https://stackoverflow.com/questions/50749891

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install Rimlight

            Setup is minimal, all you need to do is create a new material that uses the shader and assign it to your meshRenderer, then just play around with settings.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/AdultLink/Rimlight.git

          • CLI

            gh repo clone AdultLink/Rimlight

          • sshUrl

            git@github.com:AdultLink/Rimlight.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Game Engine Libraries

            godot

            by godotengine

            phaser

            by photonstorm

            libgdx

            by libgdx

            aseprite

            by aseprite

            Babylon.js

            by BabylonJS

            Try Top Libraries by AdultLink

            RadialProgressBar

            by AdultLinkC#

            TexturePanner

            by AdultLinkC#

            VerticalDissolve

            by AdultLinkC#

            SphereDissolve

            by AdultLinkC#

            WreckingBall

            by AdultLinkC#