Comments (7)
Hi there,
It should not be uploading any geometry each frame - only per-tile shader params. The geometry should be uploaded once by the OceanBuilder on startup. Unless of course there's some kind of nasty bug thats causing it to upload, let me know!
(For the record, regarding GPU instancing, if my understanding is correct this would reduce the number of drawcalls - I guess once it organises what is visible and what is not, it can draw each tile type in a single call. This would probably reduce ocean draw call count from ~40 to ~5. This is interesting but closes the door to doing additive lighting in multiple forward passes to allow local point lights affecting tiles, so I decided not to act on it.)
Let me know if that answers your question and/or if you're seeing something different.
from crest.
It could be even better with uniform tiles enabled too can't it? With that all tiles are the same except for their transform scale correct?
As for the shading/lighting features - Setting up GPU instancing won't remove any features. If in forward rendering mode the base pass will still benefit from instancing and further passes will automatically fall back to standard drawcalls.
from crest.
Yes - perhaps it could be reduced to a one draw call if all tiles were uniform. There are a couple of reasons i moved away from uniform tiles:
- They overlap and this generates not-insignificant duplicate vertex and pixel shader work
- I generate an extra strip of tris at the boundary perimeter of the ocean geom which extends the range of the ocean geom to the horizon. This is a simple and efficient solution.
It would be possible to solve the second point by manually generating this geom, or doing away with it completely (might work in some scenarios), or by having two tile types and instancing them separately (so 2-4 draw calls in total depending on how many boundary tile types are needed).
It would be good if it doesnt affect the lighting. The main thing in my mind is that if we have local point lights we'll probably only want each light to affect surrounding tile(s). If this still works with instancing, then I am understimating Unity's instancing :) and thats good to know.
I'm not sure what other problems might be encountered when moving to instancing. Maybe none.
I'm interested in trying this out, but I have other things on my plate that are more interesting and/or pressing right now. Feel free to comment on priority/motivate this. My (possibly wrong) assumption has been that 40 drawcalls is acceptable on console/PC (at least for something that fills a vast chunk of the screen). I'm aware however that the impact of draw calls on mobile is high, or at least it used to be.
from crest.
My (possibly wrong) assumption has been that 40 drawcalls is acceptable on console/PC
I think that is correct, but AFAIK it is a lot of polys to push to the GPU. I'll do some testing tonight to see the impact in reality.
FYI unity will automatically disable instancing on tiles that require the additional lighting. So if the solution is implemented it should be non-destructive to other features.
from crest.
Ok let me know. I don't foresee an issue here, the only time geometry is transferred to the GPU is on startup. At runtime it uses the existing vertex/index buffers (i just double checked with renderdoc). And FWIW its a very small amount of geometry, each tile is say 64x64 verts and i think there are < 10 tile types. In my current understanding, there should not be an issue from that point of view, but let me know if I'm overlooking something.
Good to know about the lighting, thanks!
from crest.
I just did a perf test on my laptop with a standalone build to check overall performance to make sure nothing is going horribly wrong, the total frame time is under 3.5ms at 1080p which is where i was hoping it to be, considering I've been ramping up the detail setting lately and adding loads of optional shader features which I have all turned on. (this is with quality set to 'simple' which unlocks the vsync, but this does not make the ocean cheaper).
from crest.
I will close this for now as I don't have plans to implement instancing in the short term. If i try it i'll post back here. Thanks again for the info!
from crest.
Related Issues (20)
- Local / movable spectrums or crest shapes HOT 3
- Foam / wake vibration when approaching whirlpools HOT 20
- Pressing the Windows Key in the editor disables underwater rendering HOT 3
- Wake / foam artifacts when moving the camera quickly HOT 11
- Delayed LOD / tile enabling when using large clipping areas HOT 5
- Depth Cache not populated - Exported Image is Black HOT 8
- Water interaction is not visible when moving camera away from the sea level HOT 1
- Underwater broken with XR multi-pass rendering HOT 1
- No caustics, no shadow data and/or constant shadowing on iOS
- Error of Does not exist some Classes. HOT 1
- Sporadic gaps / precision errors in tiles. HOT 35
- SphereWaterInteraction and RegisterDynamicWavesInput do not work correctly inside a flow area HOT 11
- Activating flow in the material when oceanrenderer is running does only work in editor HOT 2
- FindObjectsSortMode HOT 3
- Enable Shader API does not function without changing underwater appearance HOT 20
- Enable Shader API causes artifacts HOT 4
- Planar Reflections issue with non-standard shaders using transparency HOT 13
- Premature tile culling during extreme camera maneuvers above the ocean HOT 1
- Portal feature broken with Unity Recorder 360 View
- Directional lights that are not active on any layer change the color of subsurface scattering HOT 1
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 crest.