Coder Social home page Coder Social logo

oilstar / unityurp-mobiledrawmeshinstancedindirectexample Goto Github PK

View Code? Open in Web Editor NEW

This project forked from colinleung-nilocat/unityurp-mobiledrawmeshinstancedindirectexample

0.0 0.0 0.0 3.13 MB

Example project to draw 1million grass instances on mobile

Home Page: https://youtu.be/A7rav4tS88s

License: MIT License

C# 58.12% ShaderLab 41.88%

unityurp-mobiledrawmeshinstancedindirectexample's Introduction

UnityURP-MobileDrawMeshInstancedIndirectExample

youtube runtime demo video: https://youtu.be/A7rav4tS88s
download .apk, try it on your android phone: https://drive.google.com/file/d/185JWZXYPnVyDnA451cEZkS2H2wOYSce_/view

DrawMeshInstancedIndirect ON screenshot DrawMeshInstancedIndirect ON (grass bending) screenshot screenshot DrawMeshInstancedIndirect OFF screenshot

Why create this repository?

To demonstrate an API that can draw millions of instance -> DrawMeshInstancedIndirect(), running on mobile devices.

Can this demo runs on midrange mobile?

  • can handle 10 million instances on Samsung Galaxy A70 (GPU = adreno612, not a strong GPU), 50~60fps, performance mainly affected by visible grass count on screen(draw distance = 125)
  • can handle 10 million instances on Lenovo S5 (GPU = adreno506, a weak GPU), 30fps, performance mainly affected by visible grass count on screen(draw distance = 75)

Requirement

if you want to try the pre-built .apk, your android device must support Opengles3.2 / Vulkan
download .apk: https://drive.google.com/file/d/185JWZXYPnVyDnA451cEZkS2H2wOYSce_/view

Where are the important files

https://github.com/ColinLeung-NiloCat/UnityURP-MobileDrawMeshInstancedIndirectExample/tree/master/Assets/URPMobileGrassInstancedIndirectDemo/InstancedIndirectGrass/Core

Editor

2019.4.15f1

Note

This is a simplified example repository to demonstrate DrawMeshInstancedIndirect API on mobile platform.
This repository is as simple as possible, only contains a simple CPU cell frustum culling(not even a quadtree) -> minimum compute GPU frustum culling (no Acceleration Algorithms), then just 1 DrawMeshInstancedIndirect call, nothing else, code is very short.

Lighting and animation is not the main focus of this project, but ~40% of the time was spent on writing grass shader's lighting & animation, you can have a look at InstancedIndirectGrass.shader if you are interested.

This repository also contains a RendererFeature(GrassBendingRTPrePass.cs) to render an offscreen RT(R8), which renders top down view grass bending area (by trail renderer following moving objects), it is a very simple method but the result is good enough for this demo.

reference

unityurp-mobiledrawmeshinstancedindirectexample's People

Contributors

colinleung-nilocat avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.