loath
08-12-2013 18:28:24
[updated]
hello,
paged geometry is extremely useful for my project. the standard "BatchPage" static geometry takes too much memory, however. after reading http://http.developer.nvidia.com/GPUGem ... ter03.html, i implemented hardware instanced geometry. rather than pay instance count * mesh size in memory you only pay for the mesh once and after that it's just the cost of the per-instance data. (in this case, it supports position, orientation, scale and color packed into a 4x4 matrix)
i'm posting my implementation here incase this is useful for anyone. i'm using and have tested this with ogre 1.8.1, hlsl / directx 9, with texture shadows.
at some point in the future i'll add:
- depth shadow support
- merge in windbatch changes to sway trees, etc
does not support:
- opengl (my project doesn't support opengl so i'm unable to test this)
directions:
- add the 4 files to the paged geometry project and recompile the lib.
- alternatively, you can just include these files in your project.
- simply use "BatchPageHw" where you would have used "BatchPage" before.
updates:
- fix issue using multiple meshes with the same material names (identified by fratouille below)
- shadows can be enabled or disabled.
- batches now use the same render group as the parent paged geometry. (previously hard coded)
- added sample bumpmap shader. (requires mesh to have tangents: "ogrexmlconverter -t your.mesh.xml your.mesh")
please send any code review feedback, enhancements, etc. i'm not sure how to submit a patch so i'm uploading the files here.
thanks!
hello,
paged geometry is extremely useful for my project. the standard "BatchPage" static geometry takes too much memory, however. after reading http://http.developer.nvidia.com/GPUGem ... ter03.html, i implemented hardware instanced geometry. rather than pay instance count * mesh size in memory you only pay for the mesh once and after that it's just the cost of the per-instance data. (in this case, it supports position, orientation, scale and color packed into a 4x4 matrix)
i'm posting my implementation here incase this is useful for anyone. i'm using and have tested this with ogre 1.8.1, hlsl / directx 9, with texture shadows.
at some point in the future i'll add:
- depth shadow support
- merge in windbatch changes to sway trees, etc
does not support:
- opengl (my project doesn't support opengl so i'm unable to test this)
directions:
- add the 4 files to the paged geometry project and recompile the lib.
- alternatively, you can just include these files in your project.
- simply use "BatchPageHw" where you would have used "BatchPage" before.
updates:
- fix issue using multiple meshes with the same material names (identified by fratouille below)
- shadows can be enabled or disabled.
- batches now use the same render group as the parent paged geometry. (previously hard coded)
- added sample bumpmap shader. (requires mesh to have tangents: "ogrexmlconverter -t your.mesh.xml your.mesh")
please send any code review feedback, enhancements, etc. i'm not sure how to submit a patch so i'm uploading the files here.
thanks!