Objects graphic messed up when adding lightweight render pipeline - c#

I built a portal shader and it required me to use Lightweight Render Pipeline. i upgraded all the object materials to lightweight materials and i created a lightweight renderrer pipeline and put it in the graphics settings. Althoug,still some of the objects are pink. is there any way to fix it?
Thank you
I did what they said in "Lightweight Render Pipeline in Unity turned everything pink" but still then some of the objects left pink.
Sorry about this short qeustion, i am new at it. If you dont unsderstand my question feel free to ask
Edit:
Ruzihm solution was working for me, thanks him :D

You are using shaders that are incompatible with the LWRP. The Unity Editor can try to automatically replace them with compatible ones. In the menu, do Edit -> Render Pipeline -> Upgrade Project Materials to LightweightRP Materials, and then Unity will do its best to upgrade the materials/shaders.
This may be only a partial solution depending on if Unity can find a suitable replacement for all of your shaders or not.
For the ones Unity can't or won't upgrade, you can try configuring them with default LWRP shaders by inspecting the material on those objects, clicking Shader, and then selecting Lightweight Render Pipeline > Lit or Lightweight Render Pipeline > Unlit depending on if you want lighting effects or not.
For the terrain, you can replace its current material with the TerrainLit material:
Where to set it:
Where to find it:
[images source]

Related

How to make soft body (jello) objects or arrays? [duplicate]

I am currently using the NVIDIA FleX package in Unity3D to create soft-bodied, jelly objects. I'm using Unity for animation only, not game dev.
What I am aiming to make is a transparent, jello sphere that retains its spherical shape with elasticity.
The first way I've tried to achieve this is using Flex Array + fluid setting. I've been playing with the settings but I can't get it to remain a sphere, it just becomes a more/less viscous fluid blob.
The second way is using the Flex Soft + fluid setting. It is much better in terms of physics but even with "draw particles" off, but the water droplets are each separated and not one jelly sphere.
This is what it looks like before hitting play, where the left is with Flex Array and the right is Flex Soft. The particles for Array are visible but not for Soft.
This is after hitting play, where the Array becomes one viscous fluid, but not a sphere, and the Soft is very jello-like but the water droplets are all separated.
A solution for either of the two ways would be much appreciated!
the standard approach is to create an Nvidia Flex Controller first...
Then you should also create a Flex Soft Asset...
Then you should create or select a game object and through the Add Component tab in the game object's inspector, find the Flex Soft Actor component [see it loaded up in the image below]...
Ensure your Soft Actor Asset mentioned previously has your required mesh type selected in the inspector option [I chose sphere in the image here] and check to see it looks something like the image below to be sure...
So after that, hopefully, you can just press play and see it in action as it drops and contorts for you.
If not, I have created a quick example for you to download as a unitypackage.
It may still require further resolution with the package manager as the Flex plugin is already inside the package I'm providing here[Using Unity 2020.3.5f1]
Flex in unity package
Anyway, hope this gets you started and somewhere towards your goal with Flex.
As a bonus, I've added a small script to move the flex object as this is outside of the usual approach as we have to call to the NVidia Flex component class of choice and invoke the ApplyImpulse method.
Cheers :)
Edit: There are a small 3 set of tutorials from NV Gameworks on integrating the plugin with Unity and exampling some stuff - this "stuff" is included in my downloadable package provided above.
Here is the youtube link to the 3 set:
Nvidia Gameworks FleX tutorials on Youtube
Edit 2: rereading your question made me think I hadnt really given you the definitive answer as to using a cloth actor and having the mesh renderer deform via the flex cloth deform component.
I am providing another link to another unity package here that will show this in action also allowing you to see the game object and how the cloth component from NVIDIA Flex works with the standard mesh filter and mesh renderer. Hope this more accurately answers your question :)
Example also using Cloth Actors as well as Soft Actors in NVIDIA FleX

How to always get the AR design in front of the spatial walls Unity HoloLens

I am building an app for the HoloLens gen 1 device using Unity 2018.3.13f and MRTK V2 RC1. I got a simple AR design with 2 text objects and 1 rawimage object. After building the project and deploying it to the HoloLens the AR objects ends up behind the spatial mesh (you know all those spatial triangles), but I want all the objects to be in front of the wall.
How do I accomplish this?
The canvas is set to be on the main camera
I have the original settings for the DefaultMixedRealityconfiguraitonProfile if there is something there that needs to be changed.
This is how it looks through the hololens with the app when it does not show the mesh of the wall (sorry for the bad quality)
and this is how it looks when it falls behind the mesh
Do I need to add some mesh renderer or something on the MainCamera to make this possible?
Any help is appreciated, thanks!
I don't believe that the MRTKv2 as of 2019/5/9 has code that will auto-ensure that a specific object is positioned in between the camera and other arbitrary meshes and colliders (i.e. the spatial awareness is one such mesh, though you could imagine just having an arbitrary box or plane in the scene that would occlude that object, in which case, maybe you'd want your "in between" object to stay in between both those two types of potentially occluding things).
There used to be a script in the HTK called Tagalong.cs that would do something like this by doing raycasts from the camera to collidable object:
https://github.com/microsoft/MixedRealityToolkit-Unity/blob/htk_release/Assets/HoloToolkit/Utilities/Scripts/Tagalong.cs
This single large script I think got broken up into smaller scripts (i.e. specific behaviors in the solvers here:)
https://github.com/microsoft/MixedRealityToolkit-Unity/tree/mrtk_release/Assets/MixedRealityToolkit.SDK/Features/Utilities/Solvers
However, from what I can tell, the specific interaction of "keep things automatically between the camera and whatever collidable object" wasn't preserved. Someone else can correct me here if I'm wrong, it looks like this wasn't a behavior that got preserved in V2.
Going forward, there are a couple of possibilities:
1) Probably file an issue on Github here (https://github.com/microsoft/MixedRealityToolkit-Unity/issues) to request this feature be ported over.
2) Use the code in Tagalong.cs to add your own solver that would accomplish this (i.e. the code looks to be all there, there's just some work needed to get done to reorder it to handle what you want)
If you use a sprite renderer, set order in layer (into 0 or -1).
If you use a mesh renderer, try to deactivate dynamic occluded.
Try to change the hierarchy of the sorting layers under Edit-> Project Settings -> Sorting Layers

How to align HoloLens holograms relative to anchors in the Unity editor

I am trying to align holograms relative to WorldAnchors without manually placing them in-app. Is there any way of visualizing WorldAnchors in the Unity editor to align objects relative to their positions? I see anchor data in the Device Portal, is this at all related to WorldAnchors?
Ideal workflow being:
1) Scan a room for the first time, obtaining a room mesh .obj through Device Portal. Simultaneously run an assistant Unity app and place anchor(s) for later reference (in room corners for example).
2) Import the .obj into Unity, along with Device Portal anchors if possible.
3) Transfer these WorldAnchors to a new Unity project and align holograms relative to the anchors.
4) Run this new app for the first time on HoloLens and have holograms properly positioned in space without additional adjustment of anchors by the user.
Here is an example using Vuforia, but I would like to use WorldAnchors (or the anchors in Device Portal somehow) for a markerless solution: https://youtu.be/W7z2sggDGoo?t=1689
The script referenced here 404s: https://github.com/Microsoft/MixedRealityToolkit-Unity/issues/530
https://forums.hololens.com/discussion/10725/placing-holograms-at-predefined-locations-in-spatial-mapping-hololens almost provides a solution, but still fails to explain how anchors and the room mesh can be aligned in development for accurate placement upon opening the app.
Thank you!
Edit - Here is a similar question: Placing objects at set locations in a pre-scanned room Is there a better solution than "placing all the objects manually in some config first-run of the app"?
As far as I know world anchors only exist during runtime and there is no way to export them to unity or already add predefined ones in unity.
I had a similar problem and went with vuforia ImageTargets and it works quite nice.
It sounds like you want to make use of the WorldAnchorStore (UnityEngine.XR.WSA.Persistence). This allows anchors to be persisted on the device across sessions and between apps, and (off the top of my head) is probably the source of the anchors you see in Device Portal.
If you're using the Mixed Reality Toolkit in your project then there's a helper, WorldAnchorManager (found in Common/Scripts) that wraps the underlying functionality.

Unity3D Particle system on UI wont display in build

I have followed this particular tutorial: https://www.youtube.com/watch?v=ir9Rvi1QG8Y to add a particle system effect on a UI panel. It works well in scene mode and game mode but when built for android no particles are shown. I have tried tweaking the particle shader, material etc.. but to no avail. What do you recommend please? Thanks.
Unity version: 2018.2.11f1
Screenshot1
Screenshot2
After recreating the project myself I've found out that its because of a sloppy code in UIParticleRenderer class.
Shader foundShader = Shader.Find("UI/Particles/Additive");
in line 79
when you try the game in Editor "Find" method works correctly, but when you want to publish it to a device (android) it won't include "UI/Particle/Additive" shader so the shader won't be found.
there are 3 solutions to this problem as described for Shader.Find class in Unity documentation :
reference it from some of the materials used in your scene
add it under "Always Included Shaders" list in ProjectSettings/Graphics
put shader or something that references it (e.g. a Material) into a "Resources" folder.
I used the 2nd solution (which is easier to do) and it solved the problem. so you can go to Edit->Project Settings->Graphics and under "Always Included Shaders" section Add "UI Particles Add", then build and run your project.

Need to use Tiled Map editor with Unity 4.3.4

I shifted to unity few weeks ago. I am developing a 2D platformer. For creating the maps I am using Tiled map editor from www.mapeditor.org . I have created a basic map. Included the tileSheet png and the .tmx file (saved as XML) in the Assets of the project. I am able to read the XML , that is all the gid's. But I don't know how to access a particular portion(tile) from the tileSheet corresponding to a gid.
I think for this I need to load sprite in the memory and select a tile (by specifying Height and width and coords) from texture memory to display it on screen. As given here :http://gamedevelopment.tutsplus.com/tutorials/parsing-and-rendering-tiled-tmx-format-maps-in-your-own-game-engine--gamedev-3104
but its for flash , how I can achieve same thing in Unity using C#. Notice the copyPixel stuff in the flash code. I thought I could use ReadPixels but it is used for reading from screen only not the texture memory.
Thanks.
If you're working in Windows then the Tiled2Unity Utility sounds like it will fit your needs. It exports Object Layers and was made with Unity 4.3 features in mind.
(Full disclosure: I'm the author of Tiled2Unity)
EDIT: Tiled2Unity is available for Mac users as well now. There is a command-line version for Linux users. (all free)
If you can describe more carefully your problem and what you are trying to do, maybe myself or someone can help you better, for example what exactly do you mean by "load a sprite into memory"? Or "select a tile"? Copying pixel data is SLOWWW, and hopefully you don't mean to be doing this in real time.
Here is my real advice though:
Have you checked out UTiled? It does tiled maps in 2D in Unity so I think it already does what you want and it's free.
There is also UniTMX... free.
There is also 'Tiled Tilemaps'... which is like $2.
I also built a system that can also do what I think you are trying to do (your link is broken, so I can't be sure).
The system I built is called 'Tiled to Unity' (you can search it in youtube to see if it does what you want). It allows you to attach gameObjects to tiles and have tile variants, and can do 3D tiles.
Anyway, trying to roll your own pipeline from Tiled into Unity is a ton of work, and with these tools available, I think it is almost certainly unnecessary... That's just imo.

Categories