Questions tagged [unity3d-shaders]

For all questions related to shader technology, in Unity3D.

Use the tag for any questions related to shaders in Unity3D development.

The Unity3D game engine generally uses it's own shader language, which is, generally similar to but subtly different from other shader languages in the ecosphere.

36 questions
5
votes
1 answer

Porting XNA Shader pass, blend and cull mode into Unity shaderlab

I had to port XNA shader into Unity's shader and want to verify that I did this correctly. The Pass1 section that uses alpha blending like SrcBlend, DestBlend and set's cull to none is the only place I want to make sure I got right. This is the XNA…
Programmer
  • 121,791
  • 22
  • 236
  • 328
4
votes
1 answer

Compute shader float arithmetic is really inaccurate

I am currently writing a compute shader that requires a simple float multiplication of a float and a uint3, and I am getting really inaccurate results. for example, uint3(1, 2, 3) * 0.25 expected result: uint3(0.25, 0.5, 0.75) actual result:…
niv shalom
  • 93
  • 8
4
votes
0 answers

How to properly blend two RenderTextures?

I'm trying to create small paint app that uses RenderTexture for painting. My goal is to paint "Brush" texture with the color and alpha on the "Draw" RenderTexture (whole texture has the color (1, 1, 1, 0). I have written a shader for that, but it…
4
votes
1 answer

Glittering Effect in Unity

i'm trying to add a glittering effect to a texture on a pine tree. I tried to use the code from here http://developer.amd.com/wordpress/media/2012/10/Shopf-Procedural.pdf (P.22) as suggested in other threads. But i'm not able to apply it to my…
Lukas
  • 61
  • 4
3
votes
2 answers

Unity not rendering like hololens

I'm currently trying holotoolkit material example scene and this looks very poor in unity but great on hololens. I found some videos displaying the same as hololens in unity. this is how it looks in some videos in unity and on hololens Other…
Starbax
  • 1,005
  • 2
  • 12
  • 32
2
votes
1 answer

URP Lit Shader causes artifacts

I've upgraded my Unity project from Unity 2020 to 2021 LFS, using the URP pipeline, and I'm now seeing these lighting artifacts in scene view and game view caused by the Universal Render Pipeline/Lit shader. I generated the mesh for the floor using…
Enrique Avina
  • 973
  • 7
  • 20
2
votes
2 answers

YUV shader for Unity?

I have some (proper, planar) YUV textures in Unity, and I just want to see them for dev use. Is there actually a working YUV shader for Unity (their shader language variant) kicking around? It's simple enough conceptually to convert from YUV to RGB…
Fattie
  • 27,874
  • 70
  • 431
  • 719
2
votes
1 answer

Simply get the scaling of an object inside the Cg shader

Say you have a trivial Unity shader. It does not at all use any texture. It grabs simply the position .. void vert (inout appdata_full v, out Input o) { UNITY_INITIALIZE_OUTPUT(Input,o); o.localPos = v.vertex.xyz; } and then draws a…
Fattie
  • 27,874
  • 70
  • 431
  • 719
1
vote
0 answers

How to smooth the border between two different objects

I have two objects, a sea and a river, and each of them with its own shader. In the river delta you can see that they are two different objects and it doesn't look good. Does anyone have any idea what can I do to smooth the edges so that the seam…
kaitoren
  • 65
  • 1
  • 9
1
vote
2 answers

How do I replace if statements with ? operator for making a shader work on mobile?

I'm porting a custom shader to make it work on mobile phones since shaders inside mobiles can not have if statements. I tried replacing the if statements of my code with the ? operator but I can not compile in Unity without errors. I'm pretty new to…
H_7
  • 287
  • 1
  • 5
  • 18
1
vote
1 answer

Edit Unity shader that takes 2 vector3

This a jelly shader from unity asset store yet I cant figure out how to make it always active as it requires 2 vector3 (_ModelOrigin and a __ImpactOrigin). Any ideas on how to edit it is always active? Thats how I use it right now : …
OmaeWAc
  • 13
  • 5
1
vote
0 answers

Why is some blackout on objects here?

Hello I have a problem. I'm using 2dToolkit and when I creating objects that don't overlap they're creating some shadow at the junction of two objects. You can see it's on top rects. When I use similar sprites it doesn't appear. It's appear only…
Xoggas
  • 11
  • 1
1
vote
1 answer

Edit Offset Values in Unity URP Lit Shader via Script

I want to edit the Offset Parameter of Surface Input in Simple Lit Shader of URP in Unity, but I am not able to do so. I tried using Method SetTextureOffset still cannot update the offset value. Please Help Here is the Offset I want to change via…
AryanshDev
  • 66
  • 2
  • 11
1
vote
0 answers

Unity3d Shader Z testing question, ZTest Greater but keep behind

I'm rather new with shaders in Unity and I'm trying to create something but all my attempts failed. The scenario is this, I have the following objects: A,B,C. A is a sprite, B is a Textmesh (not GUI) and C is a depth mask rectangle. I wanted to take…
user51929
  • 185
  • 1
  • 15
1
vote
1 answer

Why does unity 2020.1.10 freeze on android build for Oculus?

I get a number of these: undeclared identifier 'sampler_CameraDepthTexture' at Assets/PostProcessing/Resources/Shaders/MotionBlur.cginc(90) (on gles3) I get a number of these in ???.cginc at different line numbers and am at a loss as to where to…
Paul Moore
  • 136
  • 1
  • 16
1
2 3