Hi! I just joined this server, hoping to find someone who could help me with a problem I'm having. I'm also quite new to Unity even though I'm accustomed to Godot already.
I'm not quite sure if this is the right place to post this, but I apologize in advance if this is not. I intend to find answers in #💥┃post-processing as well.
I'm making a simple 2D platformer game where you jump on platforms and shoot enemies similar to Doodle Jump. For aesthetics' sake, I really wanted to make a Chromatic Aberration effect which affects the whole viewport. But several days of research proved to me that the best way to get the result I wanted is to make a custom Shader graph or GLSL script.
There are some mini problems about that:
- I know nothing about GLSL or Shader/Shading in Game Dev. I know basic theory, but that's that. I can only explain in basic terms what a Chromatic Aberration is, but I am not able to implement it via Shader code. If possible I would like to avoid having to read some kind textbook published in 2012 or something due to time constraints and personal reasons.
- Above problem lead me to Shader graphs. There were only 1 or 2 videos that showed vaguely how to use them, but not implement a Chromatic Aberration effect specifically.
- Above problem also lead me to the Post-Processing and Cinemachine Unity packages, which don't help. For both of them, the Chromatic Aberration effects are distorted by the camera's position for some reason, similar to this image: https://i.ytimg.com/vi/8wxyKKp75pw/hq720.jpg?sqp=-oaymwE7CK4FEIIDSFryq4qpAy0IARUAAAAAGAElAADIQj0AgKJD8AEB-AH-CYACrAWKAgwIABABGGUgZShlMA8=&rs=AOn4CLD_OpSK15XA9RbZFDCjGKOkj3yWoQ). I want the effect to be absolutely unaffected by distortion, similar to this image: https://i.ytimg.com/vi/qE6FuJE3xm8/maxresdefault.jpg.
- I don't have a budget as I am struggling as a college student. So, I would rather avoid paying for assets.
- I have already tried this: https://github.com/brunurd/unity-chromatic-aberration, and many other repos. on the internet, which don't help since all of them only work when I attach as a shader material to the object(s). I want the entire viewport to have this effect. Not just a specific object.
I ended up wiring my own custom Shader graph from scratch. After that I used a RenderTexture to render the scene instead of using a normal camera like in this video https://www.youtube.com/watch?v=Sru8XDwxC3I. At first it worked since I can just attach my Shader graph's material to the RenderTexture on a RawImage component. Now here's the catch: My game viewport is now focused on a Canvas object (RenderTexture from earlier) which causes my other Canvas components to break. Everything is now a UI object, including the game scene.
As you can see, that is not optimal at all. If I revert back and use a normal camera, my Chromatic Aberration shader stops working since materials don't affect the camera. But if I continue with this, when I make UI objects, like say a health bar, I can't set anchors and positions normally anymore for those objects.
TL;DR Everything, including the game scene, is part of the UI, since it's in a Canvas object. This breaks my custom shader material. Need help pls 🥹
This short video tutorial covers how to get a pixelated look (also called "low resolution look" or "retro look") in Unity. This is a great effect for 2D and 3D games.
In this tutorial we learn:
- How to create a Render Texture
- How to create a Raw Image
- How to tweak some settings (game scale, camera warning, crisp pixels, resolution)
You ca...