Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Dynamic Mesh And Deformation (most efficient method?)

Discussion in 'General Graphics' started by RepublicCommando, Jun 29, 2016.

  1. RepublicCommando

    RepublicCommando

    Joined:
    Jan 8, 2014
    Posts:
    5
    I am writing myself a SVG plugin so I don't have a ton of big textures in my 2d projects.

    I've gotten things to render so far (only messing with basic shapes right now, only two days in), but I really want
    to push for animation and live deformations (specifically bone, and svg animation settings themselves, combined with MechAnim).

    This leaves me at the cross roads of how to render things. I'd like to include lighting (or at least leave a margin to implement it later my own way), and the way I'm rendering now doesn't seem to like that.

    I am using GL methods to draw a Rect (triangle strip with four points), but when I've applied a material/shader that supports lighting, I don't get it. I know this is because GL methods aren't really in the render pipeline, so I start to look at Mesh modification instead of dynamic rendering.

    After searching I only came across the realization that I have to reassign the entire Mesh every frame, after modifications. This thread explains that predicament well.

    So, I guess my question is; Is reassigning a mesh every frame efficient enough for large scenes with complex shapes? Has anyone tried it? Are there other alternatives to GL methods including lighting? My entire scene is potentially only dynamic shapes.. (and forced by default)
     
  2. mholub

    mholub

    Joined:
    Oct 3, 2012
    Posts:
    123
    I suppose GL calls should not be faster than reuploading new mesh. So if GL is ok for you, I propose to reupload mesh and see if it is fast enough

    Basically, the slowest thing is bandwidth between CPU and GPU. If it's not fast enough, you need to think how to send less data from CPU to GPU and compute more on GPU (in shaders). It obviously depends on type of deformations you want to use