How can I get correct lighting on a low poly water shader?
I have been working on this low poly water shader and I got each vertex to move up and down like I want to, I also got the shader to be transparent but I am having problems with lighting. If the...
View Articledoubles and compute shaders
I have a compute shader I use to crunch the n-body gravity calculations for my project. when I use all floats in the shader, it runs fine and can process the gravity calculations of 10,000 objects in...
View Article[Shader] Usage #ifdef DIRECTIONAL
How can I use #ifdef DIRECTIONAL in surf + vert shader? What conditions? M.b. some .cgiinc or .include or HLSLPROGRAM only etc here is full shader Shader "mitay/cutout tree" { Properties { _Color...
View ArticleHlsl Pow function platform-dependent error
Hi guys, it looks like the pow function does crazy things if the exponent is too big. For example if it's 10 it causes the shader to simply return 0, regardless the result of the operation. The...
View ArticleWebgl 1.0 error shader loop, workaround?
it seems webgl doenst support some kind of loops in the hlsl shader. My shader only have this variant. I wanna know a workaround this problem if possible and if anyone know in the future if these...
View ArticleWhy does this shader give different result Editor/ Android?
Hi, I've written a simple *curved* unlit shader in HLSL that basically translates each vertex based on the distance to the camera (the magic happens in the vertex shader): Properties { _BendFactor...
View Articlehow to approach instanceID in shader?
SkinnedMeshRenderer didn't batched in Unity. so i will implement GPU Skinning with GPU Instancing. i try to approach instanceID(like SV_InstanceID), but they are wrapped in preprocessor macro. so i...
View ArticleIs it possible to render to a texture via RWTexture2D without using...
I would like to save the output of a fragment shader to a texture, so that I can attempt to reuse the data in later shaders. I originally used Graphics.Blit, but the problem I found is that it submits...
View ArticleHow to reuse HLSL shader code?
Hello! I needed a set of shaders that curve based on the distance from camera. Basically, I took some of the default HLSL shaders Unity provides and changed the code in the vertex shader to adjust the...
View Article(Shader)How to find the cordinate of a given color inside a ramp texture?
I'm currently working on palette swap feature for my game's sprites on Unity . I know that this is normaly achieved by using a gayscale texture and then using a ramp texture to replace the colors or...
View ArticleSet list in shader (uniform)
There is a way to set a list for uniform? Something similar to "material.SetFloatArray" but with list? Or the restriction is for arrays? Also there is possible to change the array during runtime in...
View ArticleWhere Is UNITY_POSITION(pos) Defined?
Hi All, I was hoping to copy and modify the following fragment shader in UnityStandardCoreForwardSimple.cginc: half4 fragForwardBaseSimpleInternal (VertexOutputBaseSimple i) {...
View ArticleHow to get picked worldposition to clipspace, in fragment shader? (Image...
So this is all happening in an image effect shader. I have converted each pixel from clipspace to world space. Applied an offset to this in world space and now I need the new world space coordinates in...
View ArticleHow do i blur a Cubemap and Texture in CG/HLSL Unity 5
How can i blur(Gaussian) cubemaps and Textures in CG/HLSL in Unity 5?? Thanks in advanced.
View ArticleVertex and fragment shader advice
Evening, I'm learning about fragment and vertex shaders (beginner) and I kept scratching my head trying to get it right. My goal is to make a shader that is tileable (for indoor tiles) and customizable...
View ArticleTriangulate image in realtime
Hey everybody. I'm trying to create a shader that triangulates a texture. In first step the realtime part is not that important. This is my plan to achieve this: All this code is in the fragment shader...
View ArticleAdd additional UV channel for Blit
Hello, I wonder how do I send TEXCOORD1 vertex information to image effect shader when I'm doing Graphics.Blit? I've browse through the Internet however I cannot find anything useful. So if anyone can...
View ArticleSimple Unlit HLSL Shader with Rim Lighting?
Hi! I'm looking for a way to create Rim Lighting effect on a simple Unlit shader. Everywhere I looked people are using the surface shaders and I'm not familiar with them yet. Here is my current shader....
View Article"Floor" function produces artifacts in shader
Hello everyone, here is the output of the simple shader **tex2D( myTex , floor(i.uv*3)/3);** I need to do this to get a coherent noise from sampling an image. How can I avoid the flickering artifacts...
View ArticleAccessing and writing depth on a render texture in compute shader
Hey, so this might seem to be a stupid question, but so far after a few days of trying to find this I have found only people who don't know how to do this or people who assume you know how to do this,...
View Article