Home>
Details about what I want to ask here
I'm trying to project an effect (Particle System) shot with a camera using RenderTexture onto a RawImage under the Canvas, but the camera background (for example, black is specified in Solid Color in the camera settings) In this case, the effect will be reflected in the black background. If i set alpha to 0 here, nothing will be displayed this time, so I am in trouble.
* Apparently, Canvas is required to play Particle System.
If i try to force it with RenderTexture, it will not appear unless MeshRenderer is behind.
In conclusion, it was impossible.
If i am still able to do that, I would appreciate it.
■ Unity version
5.5.2 p1
-
Answer # 1
Related articles
- unity3d how to shorten code that is too long
- ios - can't implement admob in unity
- unity - how to end executeineditmode
- c# - how to use unity initialization code
- i want to implement a chat function using aws dynamo on unity
- unity - how to use invoke
- i want to implement a login function using nifukura in unity
- how to run unity on android
- differences in how to implement resourcesload () [unity/c #]
- c# - how to use unity namespace
- unity - how to simplify (simplify) sequences
- How to use Unity timestamp
- html - how to implement the head menu on the copy site
- c # - how to use dlls in unity
- c ++ - how to implement a stack
- how to make a car easier to turn in unity
- ios - how to implement sms authentication
- how to use jag array in unity
- c # - i don't know how to implement joystick
- i don't know how to use raycast in unity
Trends
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- javascript - how to check if an element exists in puppeteer
- dart - flutter: the instance member'stars' can't be accessed in an initializer error
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file
- i want to call a child component method from a parent in vuejs
- python 3x - typeerror: 'method' object is not subscriptable
I tested with version 5.6.1f1, but I think there is a big difference in the questioner's version.
Place the main camera, particle camera, particle system, two models in the background and the ground plane in the scene
The camera for particles sets the clear flag to SolidColor, the background color to ARGB all 0, and the target texture to RenderTexture (named Particle Texture)
Particle Texture color format is the default ARGB32, and the size is 256.
Place RawImage in the center of the screen, refer to Particle Texture, and set the size to 512 pixels square
ArrangementWhen you move it, as the questioner said, particles were drawn only on the opaque part of the texture.
Failure drawingIt seems that the default shader behavior of the particle system seems to be the cause, and since the alpha component is not rewritten at the time of particle drawing, the transparent part seems to be transparent as it is.
Create a new shader, download the built-in shader in the download archive, replace the entire contents of the new shader with the contents of Particle Premultiply Blend.shader in DefaultResourcesExtra, change the shader name appropriately, ColorMask Change to RGBA and write to alpha channel.
Create a new material, change the Shader to the previously created Particles/Alpha Blended Premultiply (RGBA), set the Particle Texture to the same Default-Particle as the default, and set this material to the Particle System Renderer Material .
Failure drawing part 2Now, when you enter play mode, it will be drawn in the transparent area, but black fringes will appear in the particles drawn in the transparent area.
This is a typical symptom that appears when an alpha-multiplied image is composited as if it were a straight alpha image (Is this site helpful?) This time, the material of RawImage is modified. is needed.
In the same way, copy UI-Default.shader in DefaultResourcesExtra/UI to create a shader, and change Blend to prevent alpha channel multiplication.
Decent drawingSet this shader on a new material, and set that material on the Raw Image (Script) Material of RawImage.
The fringe disappeared when drawing with this.
By placing the particle system on a single layer and rendering the camera to capture only that layer, only the particles could be rendered into the texture.
Rendering only particlesI wondered if it would work out if I changed the settings a little.
To be honest, the questioner's solution seems simpler and better than this ...