Comments (10)
For me, FrustumCulling BUG exists for all scenes. The math "looks right" but for some reason isn't working for me. The computer shader's "signed_point_dist()" method isn't returning what I'd expect.
I tried toggling each Point's xyz (e.g. (-x, y, z), then (x, y, -z) then (z, y, x) ,etc) -- so see if maybe this was caused by some confusion of axes/polarity.
I'm using UNity3d 2021.3.1f16 as well as 2022.2.1f1. Both exhibit the same issue with Frustum culling.
from gpuinstance.
I'm not able to repro this (in unity 2021.1). When I open the scenes the camera works as expected.
eg, in crowddemo I am changing fov, near plane, far plane.
What are your camera settings/other changes to get it into this state?
To increase FPS, you can create less complex LODs. eg, all the least detailed LODs in in the skinned mesh characters will have around 200 vertices or less. They look horrible up-close- but far away it isn't noticeable
from gpuinstance.
I've narrowed it down to the 'cameraFrustum' Buffer. For some reason, the values we are setting in C# are not the same values being read by the Compute Shader.
I reduced the "outside_frustum_count()" method down to ONLY checking against the "Near" plane (meaning anything frontwards at all from camera would show up).... and this fails miserably.
To validate the rest of the logic, I then HARD-CODED the 2 values in the shader to the NearCenter and NearNormal that I'm setting in the C# from startup -- and THIS WORKS. Which leads me to conclude that the 'cameraFrustum' buffer is somehow corrupting the values.
I'm new to Unity Shader customizing/debugging -- so my methods here might be crude/ancient. I'm going to do some googling for tutorials for better methods to debug a compute shader, other than my very manual method. Mainly, I want to know what values are being read from this buffer.... all I've done so far is validate that "these values are NOT what I set from C#".
from gpuinstance.
I've found a few links on debugging shaders - what is your preferred method? (VStudio, or Unity RenderDocIntegration, or other?)
I tried to simply set values from the ComputeShader into a new RWBuffer called "cameraFrustum2" and read it back in C#... but for some reason this is failing inside your "instancemesh.compute" shader (note: it works if I create a separate shader that only does this; so not sure what it is about your compute shader that makes this not work for me).
from gpuinstance.
FIXED - via trial/error/experimentation.
For my setup, it only works if 'cameraFrustumBuffer' is a RWStructuredBuffer, instead of plain 'Buffer'.
RWStructuredBuffer cameraFrustumBuffer; //camera frustum buffer
When it's just a 'Buffer', the "Vector3.X" value becomes ALL values.... so if X = 1, then the Vec3 is (1, 1, 1). So my Plane Normals were either (x, x, x) or (-x, -x, -x).... yz values totally lost/ignored.
So the fix was literally just "one word change" from "Buffer" to "RWStructuredBuffer".
from gpuinstance.
Also confirmed that "StructuredBuffer" also works (the "RW" is not required here).
from gpuinstance.
I've done some digging, it seems Buffer doesn't support vector types on some platforms (like most AMD GPUs for example) (which would explain why I cannot reproduce this issue 💯 )
StructuredBuffer should suffice instead (We don't need RW on this buffer since the entire buffer gets set before the kernel is invoked)
Wanna make a pull request?
from gpuinstance.
you wrote: "Wanna make a pull request?"
I haven't cloned your repo and am not set up for that here yet. For this "fix" it's only a 1 word change... making that one line read as:
StructuredBuffer<float3> cameraFrustumBuffer;
So my preference is for you to just make this first change on my behalf.
from gpuinstance.
pushed fix, thanks for finding this issue and troubleshooting
from gpuinstance.
It's just a small thing compared to what you have already done for the rest of us!
from gpuinstance.
Related Issues (17)
- Android Doesn't Work At All HOT 2
- Changing the Layer of Instances? HOT 1
- Diffirent Shader HOT 1
- Appending Position is 1 frame late? HOT 5
- How do textured instances work? Is there a better way to reparent instances in batches? HOT 8
- Not an issue - Amazing Project! Would love to have a URP version, even payed! HOT 9
- "Tried to parent a child to an unitialized parent" error on a parent that's already been initialized multiple frames ago. HOT 3
- Packaging iOS to draw real-time point cloud will report an error,How to solve this problem? HOT 1
- How to bake and play a Transform-Animation
- Enabling/Disabling Animations For Certain Bones HOT 6
- Camera Controls Wonky (always rotating with mouse) HOT 1
- High GPU Usage for Culling? HOT 10
- Univeral Render Pipeline support HOT 1
- Help with positioning HOT 7
- Edit2: Getting instance's position in shadowmap for uniform shading shader HOT 5
- Changing render distance of instances HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gpuinstance.