Quantcast
Channel: Questions in topic: "hlsl"
Browsing all 206 articles
Browse latest View live
↧

Persistent Data in Compute Shaders.

Hey there, I have created a little raytracer in unity using the compute shader and now I want to store (for example) the last 100 outputs on the GPU memory for later calculations. The CPU does not need...

View Article


In ShaderLab, does alpha blending automatically turn off writing into depth...

I have two semi transparent squares, one in front of another. So i want the one in the front to occlude the one behind, so that further square would not be visible behind closer square. Essentually i...

View Article


How to get red underlines for bad syntax and code suggestions for hlsl code...

I just started with shader coding in unity and I am trying to figure out how to get similar features to what we get in C# (if I type gibberish in C# it underlines in red, if I start typing a variable...

View Article

How to get surface shaders to work in URP?

When coding shaders into my Unity project (2019.4 using URP) I get the magenta error shader anytime that I use surface shaders. No errors are reported in the Console. How do I get surface shaders to...

View Article

How to share constant variables between Compute Shaders?

So, I have two compute shaders A and B. Right now, before every dispatch, I send my mouse coordinates to both of them every update. So, from my understanding, you can actually determine which register...

View Article


How do I decode a depthTexture into linear space to get a [0-1] range in HLSL?

I've set a RenderTexture as my camera's target texture. I've chosen `DEPTH_AUTO` as its format so it renders the depth buffer: ![alt text][4] I'm reading this texture in my shader, with `float4 col =...

View Article

Shader shows odd Simplex Noise behavior on Android

I'm using a 3D Simplex noise generator [from this repo](https://github.com/keijiro/NoiseShader/blob/master/Packages/jp.keijiro.noiseshader/Shader/SimplexNoise3D.hlsl), which is essentially an HLSL port...

View Article

When can I use Shader.EnableKeyword()?

I'm trying to use a preprocessor macro in my custom shader so it performs a different step if it's in the Unity Editor: #if defined(IS_UNITY_EDITOR) // something #else // other thing #endif To achieve...

View Article


Opaque ("overwrite") Projector Shader for Decal Projection

I have been attempting to make a simple "overwrite" version of Unity's projector shader. I can either respect the color, or respect the transparency, but not both. I have simplified the frag method to...

View Article


Wireframe Shader With Shared Lines Removed

I am working on this wireframe shader: It uses some adapted code from various shaders, and I am wanting to get rid of the lines that cut through the quads. I really do not know how to go about this in...

View Article

What happens when the alpha value is outside the 0..1 range in surface shader...

If I create a surface shader with a custom lighting model, I need to return a half4 containing RGBA values. I noticed that if I set the alpha of the return value to a value outside the 0..1 range,...

View Article

Broken HDRP Lit and Unlit Shaders

I'm using HDRP 10.3.2 with Linux and I've noticed that the HDRP/Lit and HDRP/Unlit shaders are broken. The lit shader error references a 'UnityRaytracingMeshUtils.cginc' which I believe is a typo as a...

View Article

Porting UnityCG shader to HLSL to use on UniversalRP

I'm trying to use this custom shader from Sebastian League on Universal Render Pipeline, but since it only accepts HLSL language i have to port it. Its supposed to display a flat projection of a camera...

View Article


remove empty values from computebuffer in computeshaders

i have a 3d computeshader that transfers a large float3 computebuffer with locations to the cpu to make draw calls and a float4 one with the colors , but this also ends up creating uneccesery draw...

View Article

How to multiply a float4x4 and a float4 in unity shaders?

I'm trying to make a post-processing shader to simulate what a colorblind person would see. In glsl you should just need to multiply the color by a mat4 but unity shaders doesn't have this since I...

View Article


Hdrp 8.1 -> 10.4 Upgrade SetGlobalXXXX Problem

Unity Version 2020.2.0a18 Alpha -> 2020.3.3f1 Lts Upgrade Then, it was HDRP 8.1 version before, but it was upgraded to 10.4 version. Thus, the existing HD Additional Camera Data.custom Render +=...

View Article

How do int textures work in ComputeShaders?

I'm having trouble understanding how to write into a RenderTexture with an integer format (e.g. [RGInt][1]). The following code leads to a completely black texture but by my understanding, it should be...

View Article


HLSL convert float to int losing precision

I have the following frag function in my vertex shader: (the rest of the shader is the Sprite-Default shader that ships with Unity). float4 SpriteFrag(v2f IN) : SV_Target { float4 c = tex2D (_MainTex,...

View Article

HLSL bit shifting

I have a sprite that I am trying to enable palette swapping on. I've written a tool to iterate over the color values in the sprite and encode the colors palette index within the first(?) two bits in...

View Article

regarding Shader Optimization

I have a shader with 3 seperate effects on it. 2 of the effects are mapped using textures (named "_TeamTex" and "_MuzzleTex"). If the effects shouldn't trigger, the base texture _MainTex should be used...

View Article
Browsing all 206 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>