Tagged Questions
0
votes
0answers
20 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 ...
0
votes
1answer
37 views
What is the best practice in importing models to Unity
Is it better to shade a model inside the 3D modelling software or inside unity?
as an example if I need to use a transparent model should it be made transparent inside the modelling application or ...
0
votes
1answer
44 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
68 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
139 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
48 views
Global variables with fixed shaders
In Unity3D, can I use global shader uniform variables with fixed function shaders?
3
votes
2answers
542 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
60 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
94 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
62 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
374 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
96 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 ...
1
vote
1answer
216 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
93 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
122 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
131 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
190 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
190 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
544 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
472 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
0answers
77 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
256 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 ...
1
vote
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
981 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
109 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
471 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
555 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
598 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
139 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
127 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
931 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
341 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
209 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
522 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
489 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
391 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
919 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
158 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
9k 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.
4
votes
1answer
1k views
Custom shadow mapping in Unity 3D Free Edition
Since real time hard and soft shadows are Unity 3D Pro only features I thought I will learn Cg programming and create my own shadow mapping shader. But after some digging I found that the shadow ...
6
votes
1answer
396 views
Huge 2d pixelized world
I would like to make a game field in a indie-strategic 2d game to be some a-like this popular picture.
So every "pixel"(blocks) changes it's color slowly, sometimes a bright color wave happens, etc, ...
11
votes
2answers
1k views
Why are trees shining in background?
Currently I am creating a forest scene in the dark, and the trees are shining far away, but when I get close they are fine. I have the shaders set to "Nature/Tree Soft Occlusion [bark/leaves]", but ...
1
vote
1answer
1k views
What kind of shader is this?
Cube World uses a pretty good looking shader, I especially like the shading of the characters:
Is this soft shading? I'd like to achieve this effect in Unity 3D Free, but since the free version ...
2
votes
1answer
2k views
Unity custom shaders and z-fighting
I've just readed a chapter of Unity iOS Essential by Robert Wiebe.
It shows a solution for handling z-figthing problem occuring while rendering a street on a plane with the same y offset.
Basically ...