-
Content Count
2 -
Joined
-
Last Visited
Content Type
Profiles
Forums
Omnibus
News
Features
Downloads
City Journals
Calendar
Gallery
Everything posted by krzychu124
-
Rendering with replacement shader problem
krzychu124 posted a topic in Cities: Skylines Modding - Open Discussion
Hi, I'm working on improved rendering system for TM:PE. Currently I have 100% working version of rendering system (custom shaders and other stuff) in Unity Editor. The heart of rendering system is custom Replacement Shader to create depth normal texture. I am using additional camera to render that texture using camera.renderWithShader(shader, "RenderType") That texture is used in every Renderer shader to render literally anything (procedural shape, texture, bezier lines) on intersection between Renderer and object within(inside) that cube. Renderer - empty GameObject with attached MeshRenderer and MeshFilter with sharedMesh - regular cube of size (1,1,1) with custom transparent shader which uses Replacement Shader texture for intersection calculations. Example below - Unity Editor: https://www.youtube.com/watch?v=U_osHmVfYpM The problem I have is that when I moved everything to mod project, nothing is working as expected. I mean nothing is rendered at all. I've checked which RenderTypes are used by game for rendering terrain, road networks and other things. I've added necessary SubSteps to Replacement Shader to properly discover object of which shader has to be replaced during rendering with replacement shader and still nothing. MeshRenderer enabled, isVisible == true if camera looks at renderer location (tested in Update method of Renderer MonoBehaviour object) I use Nvidia nsight as Frame Debugger to check if shader and mesh is rendered. Shader is used by Renderer but nothing is drawn there. I tried setting RenderType to null/string.Empty but after that change, Renderer texture/shape is rendered on top of cube - Renderer cube meshes is not skipped while rendering depthNormals texture by replacement shader. According to Unity manual with RenderType set to null or empty string, every object is rendered with replacement shader, but when I leave that tag as it should be ("RenderType") nothing is drawn even if I have proper SubShaders inside replacement shader. Shader "Custom/Net/Road" => "QUEUE" = "AlphaTest" "RenderType" = "TransparentCutout" Shader "Custom/Net/Group/Road" => "QUEUE" = "AlphaTest" "RenderType" = "TransparentCutout" Shader "Custom/Terrain/Default" => "QUEUE" = "AlphaTest" "RenderType" = "Terrain" I am using "QUEUE" = "AlphaTest+1" in Renderer custom shader so it should be rendered after IIRC. Additional note: When I use standard diffuse shader for Renderer mesh, game renders it properly. I will try to replace Replacement Shader logic and experiment with Camera.depthTextureMode = DepthTextureMode.DepthNormals and use _CameraDepthNormalsTexture.- 1 Reply
-
- 1
-
-
- cities skylines
- rendering
-
(and 3 more)
Tagged with:
-
Rendering with replacement shader problem
krzychu124 replied to krzychu124's topic in Cities: Skylines Modding - Open Discussion
I've fixed that, finally. I totally forgot about copying camera culling mask- 1 Reply
-
- cities skylines
- rendering
-
(and 3 more)
Tagged with:
