Comments (8)
If each voxel you have is a a single cuboid then you would need to write a fragment shader to make special textures. Voxel games like minecraft solve this problem by using texture atlas and having 2 triangles per square- which allows texture atlasing over a mesh.
This library maintains a hierarchy tree depth for every instance in the object hierarchy. When you take an object with 1000 children and delete its parent- the depth of every child changes. The depth has to be recalculated for every child recursively. This is required so the compute shaders will perform world2Object, object2World calculations in the correct order. Ie, it batch calculates relative positions using the depth ordering. Depth 0, 1, 2, etc...
In the parenting function, it should not recalculate the depth if it does not change. Ie, you reparent your root object to be at the same hierarchy depth- it does not do a recursive depth adjustment. I would recommend that you do not change the hierarchy depth of your root objects or other objects with many children.
See
I don't know enough about your use case to provide more than this. I would also suggest using the unity profiler and add samples to relevant locations in the code to track down which functions are causing performance issues.
from gpuinstance.
Okay, well I'm not changing the hierarchy depth, it's always one parent deep, so I don't think that's the problem. My question is mainly, if I give every instance its own texture, and change it as I go, will that interrupt the instancing and defeat the purpose of the whole library, or will it behave the same way it would without any textures?
from gpuinstance.
As long as you are reusing materials you have previously created, you will see a benefit from instancing.
There is a guaranteed draw call for every unique (mesh, material).
Assuming you are just using the same cuboid for every voxel, this means you would get a minimum number of 1 draw call per unique material.
If every voxel has a unique material you will see no benefit from instancing
from gpuinstance.
Ok thanks for clearing that up! My next question would then be, would a unique uv map per voxel cause an additional drawcall as well? I assume it counts as a different mesh and therefore yes, but I just want to make sure.
from gpuinstance.
If you are using a single texture atlas for all voxels and packing the uv coordinates into the vertex data then no, it would just be one draw call since the only thing changing is the offset/scaling on the shared texture.
from gpuinstance.
Oh ok then, well I guess I'll give that a shot, thanks!
from gpuinstance.
Sorry misunderstood the question, yeah if you have a mesh which has different vertex data then it is guaranteed to be a unique mesh and cause a new draw call.
from gpuinstance.
Oh ok, nevermind then. It doesn't really matter regardless, as I realized that the texture would have exceeded the maximum size in unity, and been absurdly inefficient. I think I'm going to focus on optimizations other places, and then worst case scenario, write my grouped meshes to the render buffer without instancing. Thank you for being so helpful as always, and I'll be sure to let you know if I have any other problems :)
from gpuinstance.
Related Issues (18)
- 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
- 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
- WebGL Build Error HOT 2
- Enabling/Disabling Animations For Certain Bones HOT 6
- This Project is the Bomb! Thank you! HOT 10
- 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.