Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by al3ksejkramaric · May 24, 2021 at 01:45 PM · unity 5performancemodular

Looking for direction | Insects crawling on floors/walls | Performance, modularity, help me make insects crawl on the floor/walls

Hello.

I am just looking for a direction.

I want to create tiny insects crawling on the floor and/or walls. It would be great if the insects would react to player and avoid or run away from him, but if not, its ok too. Depends on the performance cost.

What would be the most modular and optimized way to make that? Because the game is in production It HAS to be optimized and it has to be made in a way that level designers can place or determine in levels where they want insects and where they don't want them.

Looking forward to see some ideas and/or directions and/or suggestions and/or tips!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by andrew-lukasik · May 24, 2021 at 02:06 PM


I suggest you use particle emitter for this, either Particle System or Visual Effects Graph. Spawn mesh particles on a plane and make them move randomly in local space so designers can resize & rotate this plane. Particle systems comes with plenty of tools to fake this and make it look good, although require some basic fx skills to setup. What's more you can generate an additional textures with position normals or other custom data.


(source files) To implement this as VFX Graph you may want to think about it as two separate subjects:

Script that generates path data

This script can do raycasts, navmesh generation and sampling etc. - whatever you need to generate a valid path.

Here is a most basic example you can start from:

GenerateVisualEffectData.cs

 using UnityEngine;
 using UnityEngine.VFX;
 [ExecuteAlways]
 public class GenerateVisualEffectData : MonoBehaviour
 {
     [SerializeField] VisualEffect _visualEffect = null;
     Texture2D _texture;
     void OnEnable ()
     {
         if( _visualEffect==null ) return;
 
         const int pathLength = 128;
         const int numPaths = 32;
         _texture = new Texture2D( width:pathLength , height:numPaths , TextureFormat.RGBAHalf , 0 , true );
         _texture.wrapMode = TextureWrapMode.Clamp;
         for( int y=0 ; y<numPaths ; y++ )
         for( int x=0 ; x<pathLength ; x++ )
         {
             Vector4 vec = Random.insideUnitSphere;
             _texture.SetPixel( x:x , y:y , new Color{ r=vec.x , g=vec.y , b=vec.z , a=vec.w } );
         }
         _texture.Apply();
 
         const string k_paths_param = "my point cache";
         if( _visualEffect.HasTexture( k_paths_param ) )
             _visualEffect.SetTexture( k_paths_param , _texture );
         else
             Debug.LogWarning($"no \"{k_paths_param}\" texture param",_visualEffect.gameObject);
     }
     void OnDisable ()
     {
         if( _texture!=null )
         {
             if( Application.isPlaying ) Destroy( _texture );
             else DestroyImmediate( _texture );
         }
     }
 }

Vfx Graph

Vfx Graph that moves particles along pre-generated paths + all the special effects fx artists would add (mesh shader animation etc)

vfx graph sample position from texture


generatevisualeffectdata.zip (49.6 kB)
Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image al3ksejkramaric · May 24, 2021 at 04:07 PM 0
Share

But is it possible to make a bug crawl from floor to wall using these systems? That's what's bugging me. If you put a particle system on the wall and another on the floors, the bugs will crawl through walls and floors at the edge that floor and walls meet.

I found this: https://www.youtube.com/watch?v=K5s7FM3CAic&ab_channel=PersistantStudios-PopcornFX

It would be awesome if I could replicate that. Not sure about performance or how one would go about this using current Unity particle systems or if it is even possible to achieve this without writing your own particle system or using another plugin. It would be great if some1 could confirm if its possible and how performant it is.

avatar image andrew-lukasik al3ksejkramaric · May 24, 2021 at 10:49 PM 0
Share

No need to write your own, new VFX Graph is most powerful and efficient. It gives you programmable particles simulated on GPU. Limiting factor is vfx knowledge here.

avatar image al3ksejkramaric andrew-lukasik · Jun 01, 2021 at 12:20 PM 0
Share

Nope. Vfx graph isn't enough. After a lot of research I see now that the problem is too hard, unless level designers would make separate hidden meshes just for bugs to crawl on, so no dynamic solution.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

221 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Huge Overhead with Empty Scene on iOS? 0 Answers

what's the best to animate 50 circles at once? performance wise on mobile 0 Answers

Will Multiple Billboarding Sprites Kill My Game Performance ? 0 Answers

UNet performance limitations 0 Answers

How do I get rid of seams that are showing up with lightmapping? 5 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges