Skip to main content

All Questions

Tagged with
1 vote
1 answer
95 views

How do I render a sector (pie/cake slice) of a circular Unity 2D GameObject?

I have a circular GameObject in Unity 2D with a SpriteRenderer attached. I want to attach a custom component to my ...
0 votes
1 answer
98 views

How Can I programatically identify a Material in Unity?

I have some gameobjects that in some conditions have an additional material added to them programatically at runtime. I then later want to be able to remove that specific material. How can I identify ...
0 votes
1 answer
83 views

Unity shader invalid subscript worldPos

I am trying to write a shader for Unity that replicates Splatoon's painting system, but I cannot get the shader to compile. It has an error on line 41 stating invalid subscript 'worldPos' at line 41 (...
0 votes
0 answers
35 views

How do I repeatedly change the colors of a list of cubes in run time without causing a bottleneck to my fluid simulation?

I am coding a 3d fluid simulation. I want to render each cell of the simulation grid with a cube, so I have a grid of cubes. Each cube has its own color, and the colors are stored in a compute buffer. ...
0 votes
0 answers
301 views

Frustum culling using compute shader, how?

I'm working on a little project for a while - creating an area where you can spawn a bunch of grass. I've overcame a major headache when figuring out the GPU instancing for the mesh and the code looks ...
8 votes
1 answer
1k views

How do I make volumetric grass?

I've been extremely interested in volumetric technology, especially for grass. Online resources are extremely scarce on this topic. What is the difference from creating a lot of mesh billboards? Is ...
6 votes
3 answers
1k views

XNA shader compiler error in release mode

I'm having a hard time figuring out if I'm doing something wrong, or if there is a bug with Visual Studio. I want to pass a float into my pixel shader, clamp it to a value, and then return it as part ...
6 votes
3 answers
5k views

How to code shaders in C# without resorting to other programming languages?

I'm working on game and game engine and want a way to prototype shaders. I'm not skilled with C++ or GLSL or HLSL or something, but I can code in C#. My question is: How can I code shaders in C#, ...
0 votes
0 answers
69 views

How to hide part of character under slope

As shown in the image below I'm trying to find the points in which a line in the world space intersect a sprite. The idea was to get the corresponding values inside a shader to play around with pixel ...
0 votes
1 answer
135 views

Which is better to use C# and Shader to move textures?

We could use C# code Material.SetTextureOffset to move a texture, and ShaderGraph can do the same by Time and ...
1 vote
1 answer
313 views

How to share constant variables between Compute Shaders?

So, I have two compute shaders A and B (using unity and HLSL). Right now, before every dispatch, I send my mouse coordinates to both of them every update. So, from my understanding, you can actually ...
2 votes
3 answers
10k views

Convert shader that uses a texture array to ShaderGraph

I am working on procedural generation in Unity, and am now a bit stuck. I am using Perlin noise to generate a heightmap, including lacunarity, persistence, octaves and frequencies. Today I have been ...
0 votes
1 answer
222 views

Custom Unity shader makes mesh look different

I am very much new to custom shaders. My actual problem is that I want to fade a mesh in and out via C# in Unity. However, the materials on the mesh I am using are opaque and setting them to ...
1 vote
3 answers
1k views

Spatial Jitter problem in large unity project

I have a very large environment where i am getting very weird view of objects as picture given below: As you can see there are black lines/spot, maybe the vertex lit problem. Currently I am using ...
0 votes
0 answers
97 views

Increase opacity of a floor plane along the path travelled by a cube

I have a plane object (a normal Unity 3D Plane, but it can be a complex floor in the future) and a cube is moving on the plane. Currently, the plane is transparent. I want to make the plane opaque as ...

15 30 50 per page
1
2 3 4 5
8