1
vote
0answers
83 views

How to implement efficient Fog of War?

I've asked a question how to implement Fog Of War(FOW) with shaders. Well I've got this working. I use the vertex color to identify the alpha of a single vertex. I guess the most of you know what the ...
2
votes
2answers
127 views

How to implement Fog Of War with an shader?

Okay, I'm creating a RTS game and want to implement an AgeOfEmpires-like Fog Of War(FOW). That means a tile(or pixel) can be: 0% transparent (unexplored) 50% transparent black (explored but not in ...
0
votes
2answers
21 views

Material tiling and offset in unity

Ambiguity: What exactly is the difference between Tiling the material and Offset of material? Need to do: I need the material to be repeated n times on the object where I need to set the value of n ...
0
votes
0answers
41 views

How to pass a custom array of data to a shader

I want to know how to pass an array of data (it will be an encoded map, actually) to the fragment shader so I can query it as an array. AFAIK this is sadly not implemented in unity, so I'm looking ...
1
vote
1answer
45 views

Unity, shader, vertexID

I'm writing a shader and I just wanna ask if it's possible to get the ID of the vertex that is currently being manipulated. I read something about gl_vertexID, but I couldn't find out if that is ...
0
votes
0answers
28 views

Using a Quad to cut out a Layer?

Looking for options on this, but I wanted to take a Quad (or other shape), apply a material to it, and have it cutout an entire layer, to reveal the layers below/behind it. Sort of like a portal ...
1
vote
2answers
71 views

Should I shade models before or after importing them into Unity?

Is it better to shade a model inside the 3D modeling software or inside Unity? As an example, if I need to use a transparent model, should it be made transparent inside the modeling application or ...
0
votes
1answer
76 views

Projective texturing and falloff

I quite understand how projective texturing works. I implemented successfully a shader for that following nvidia doc. The major problem I'm facing is that with that implementation the projector ...
1
vote
1answer
115 views

Why Does unity_LightPosition[0] Seem to Depend on Camera Position?

I'm trying to write a fairly basic shader but I keep running into lighting issues with Unity. My first problem was trying to figure out which variable stored the light's position in world space. ...
2
votes
1answer
257 views

2D metaball liquid effect - how to feed output of one rendering pass as input to another shader

I'm attempting to make a shader for unity3d web project. I want to implement something like in the great answer by DMGregory in this question. in order to achieve a final look something like this.. ...
1
vote
0answers
58 views

Global variables with fixed shaders [closed]

In Unity3D, can I use global shader uniform variables with fixed function shaders?
3
votes
2answers
727 views

Unity - Part of the sprite is covered in shadow

I have a sprite with Transparent/Cutout/Diffuse shader. Recieving shadows is turned on in SpriteRenderer. The light is a pointlight and I am using deffered rendering path. However when I am above or ...
-1
votes
1answer
80 views

Unity's pack 4 floats

Linked to: GLSL pack floats into an RGBA texture I found EncodeFloatRGBA/DecodeFloatRGBA shader functions in Unity https://gist.github.com/hecomi/9580605 Now I try to figure out how they work. So I ...
2
votes
1answer
116 views

Possible to create transparency shader which doesn't stack alpha values

The image above best demonstrates what I'm trying to achieve. It's a transparent shader for objects, but wherever the objects with this shader intersect they don't add together but simply merge with ...
1
vote
0answers
68 views

SpotLight in ForwardBase pass using forward rendering

Is there anyway I can force Unity to allow me using a custom shader to render spotlights in a ForwardBase pass (using Forward Rendering Path)? For what I could see since now: Unity use and ...
2
votes
2answers
541 views

Shader that “cuts” hole through all geometry

How can I create a shader that "cuts" through all geometry, only rendering the clearing background in Unity? An example: That's a prism in a huge white box-shaped room. The surface of the prism is ...
1
vote
1answer
131 views

In Unity, how can I read the color from _LightColor0 in a shader?

I have a scene with a point light and alpha textured (RGBA) triangle strips. I want to apply the point light color with a shader. Shader "Custom/Test02" { Properties { _MainTex("Texture ...
2
votes
1answer
277 views

Alpha Blending: use the pixel with the smallest alpha

I'm writing a transparency shader where I need any intersecting textures to, wherever they overlap, take the texture pixel with the smallest alpha value and render only that, discarding the other ...
0
votes
1answer
107 views

Surface shader ignores lighting in vertexLit path

I want to use a surface shader in VertexLit(not Forward) rendering path. I caused a problem that the compiled shader completely ingnores lighting from the light sources on the scene. Here's the code: ...
1
vote
0answers
180 views

How can I combine my scrolling effect with the vertex lit shader?

I want my shader to work in both Forward and VertexLit rendering modes. I'd written a texture scrolling shader, but I also want to consider lighting which is produced by Vertex lit shader. I can't add ...
2
votes
1answer
158 views

Surface shader with VertexLit causes black object

I wrote the simplest possible surface shader: Shader "SimpleSurf" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} } SubShader { Tags {"RenderType"="Opaque" } ...
2
votes
2answers
239 views

How can I calculate spotlight lighting in Vertex/Fragment shader in Unity?

I've written a vertex/fragment shader for my game. It uses 3 textures and represents a floating water on the wall (so I have 1 texture for water, 1 for geometry and the last one is mask) so it looks ...
0
votes
1answer
206 views

Using Appendbuffers in unity for terrain generation

Like many others I figured I would try and make the most of the monster processing power of the GPU but I'm having trouble getting the basics in place. CPU code: using UnityEngine; using ...
1
vote
0answers
697 views

How can I get this Shader for Unity working with Normal maps? [closed]

So I'm by no mean a shader coder, but I've been hacking around the last few days trying to get working a shader for the sprites of the skeletal animation tool Spine in Unity that can properly use ...
3
votes
1answer
567 views

Issue with interpolation on a burn shader (lerp and smoothstep)

I'm trying to create a simple burn shader. See here for more info on the method I'm using. However, I don't get why replacing the smoothstep with a lerp results in completely different results. Am I ...
0
votes
1answer
103 views

VertexColor shader is not working correctly in built application

I want to change the vertex colors of my mesh. The light sources must not affect the objects with this shader, its lighting must be determined only by its vertices colors, so I turned the Lighting ...
2
votes
2answers
285 views

How can I support many point light sources in a dynamically-generated level in Unity?

I'm currently working with a dungeon game which is similar to Dungeon Keeper by Mythic Entertainment. I'm using Unity and developing this game for Ipad 2 and above. Player can modify his dungeon, and ...
1
vote
2answers
1k views

2d metaballs with shader to give blobs of water effect?

I want to simulate blobs of water in a 2d game in Unity3d. One possible way of doing it is to use 3d metaballs moving in a 2d plane though this is very processor intensive. Do you think it would be ...
2
votes
1answer
1k views

Additive “Sprites/Default” shader

The Sprites/Default shader multiplies the color with the provided tint, while I need to add it instead. I fixed this copying the shader (taken from here) and simply changing the line return ...
1
vote
1answer
1k views

Shader which supports vertex colors and pixel lights?

From my question at Unity Answers: Hello everyone, I'm facing a bit of a problem here: I need a shader which has the ability to colour individual vertices and be lit pixel by pixel. Until recently, I ...
4
votes
1answer
1k views

Faking 2d light using shader (Unity, Shaderlab)

Since the concept was difficult to explain in words for someone who's not quite familiar with shader, I described it in pictures. I'm currently using Unity and it seems Shaderlab is the best choice ...
0
votes
0answers
118 views

Unity3D object fill shader

I've been researching this for a while, and had no luck yet. I figured I'd ask here to see if anyone had any good ideas. Essentially what I want is a shader that can make only part of an object ...
0
votes
0answers
529 views

How do I use UsePass in a shader in Unity when the pass does not have a name?

I'm trying to use passes from a given built-in shader in Unity. The docs say that the syntax is UsePass "Name". The problem is that built-in shaders don't have names on their passes. How could I do ...
1
vote
1answer
651 views

How to automatically render all opaque meshes with a specific shader?

I have a specular outline shader that I want to be used on all opaque meshes of the scene whenever a specific camera renders. The shader is working properly when it is manually applied to some ...
0
votes
1answer
699 views

Directional light causes an FPS drop

I have only one object in the scene and it is lit with a directional light. It uses the mobile/diffuse shader. The issue is that on iPhone 4 the FPS drops from ~42FPS to ~11FPS when the directional ...
0
votes
0answers
154 views

Terrain effect animations in Unity

I am trying to find out how can I make terrain effects animations that are possible at any given position. I have though about this and I can't seem to find any ideal solution using the following: a) ...
3
votes
1answer
131 views

How to categorize textures into atlases

I am going to use texture atlasing for the first time in my games, and at first it seemed like a great idea to split textures into atlases by categorizing them by terrain themes e.g ForestTextures, ...
2
votes
1answer
2k views

How to create HDR and bloom in Unity3D?

Unity3D's reference describes the HDR Bloom as: Using HDR allows for much more control in post processing. LDR bloom has an unfortunate side effect of blurring many areas of a scene even if ...
1
vote
1answer
1k views

Volumetric Fog Shader - Camera Issue

I am trying to build an infinite fog shader. This fog is applied on a 3D plane. For the moment I have a Z-Depth Fog. And I encounter some issues. As you can see in the screenshot, there are two views. ...
2
votes
1answer
347 views

Fog shader camera problem

I have some difficulties with my vertex-fragment fog shader in Unity. I have a good visual result but the problem is that the gradient is based on the camera's position, it moves as the camera moves. ...
1
vote
1answer
217 views

Why does my blur shader implementation produce this strange result?

I tried to implement the blur shader shown here. Instead of having a simple 2D texture I use Unity's GrabPass function to capture what's behind the plane to have a transparent effect. Then I apply ...
2
votes
1answer
576 views

Simple Optimized Blur Shader

I have a vertex-fragment shader that use the Unity3D GrabPass functionality (it grabs the screen). And I apply my GrabPass to have a transparent effect. GrabPass { "_GrabTex" } sampler2D ...
8
votes
1answer
538 views

2D Water top surface profile

I am trying to create the effect of the water surface thickness with a vertex-fragment shader. I am in a 3D game environment but It's a scroll view so a "2D" view. Here is a good tutorial of creating ...
0
votes
2answers
2k views

2D Water Shader

I am trying to build a 2D Water shader and I am using Unity but the plateform isn't a problem. Here is an example of what I am trying to reproduce : Limbo water shader Are there any good tutorial or ...
1
vote
1answer
406 views

“lerp” returning value (Shader)?

I don't understand the lerp example in this code : if(dot(WorldNormalVector(IN, o.Normal), _SnowDirection.xyz)>=lerp(1,-1,_Snow)) o.Albedo = _SnowColor.rgb; else ...
1
vote
1answer
1k views

How to do Triplanar Texturing

Ok maybe i'm missing something because its getting late and i've been programming now for about 72 hours straight (minus a nap or 2) ... I'm trying to write a shader for unity that will apply ...
5
votes
3answers
984 views

Does Unity's “Transparent Bumped Specular” translate to “semi-shiny must be semi-transparent”?

Unity's documentation for the "Transparent Bumped Specular" shader/material-type is simply a concatenation of each of the descriptions for its Transparent and Specular Shaders (and also Bumped, but ...
3
votes
1answer
161 views

Messed up UVs in Unity3D for Android

All of my quads appear correctly textured on the Unity3D editor, a Motorola Xoom Android tablet, and on an iPad 2: But on our Samsung Galaxy Mini 2 smartphone they kinda look like this: I wrote ...
2
votes
1answer
10k views

Unity3D draw call optimization : static batching VS manually draw mesh with MaterialPropertyBlock

I've read Unity3D draw call batching documentation. I understood it, and I want to use it (or something similar) in order to optimize my application. My situation is the following: I'm drawing ...
2
votes
1answer
1k views

Blur shader without render textures?

Is it possible to append a blur shader to a standard (diffuse) shader ? I am looking for a way to do this as Unity indie doesn't allow render textures.