overlay texture in after effects - overlay

probably this is a dumb question, but i can't figure it out
Is there a way to overlay a texture on certain objects, using AE ?
Example. I have a 3DS render of a door in brown and would like to use another texture of that door, without rendering the same scene 2 times (second time would be with the alternative texture)
Thanks for any help on this

Make your layer "add" or "Overlay".
https://forums.creativecow.net/thread/2/865800

Related

Should I use UI image or sprite Unity

I am making a castle wall and right now I am using a square for the wall and 3 capsules for the "empty" spaces. Because they're the same color as the background. Is this a proper way of approaching this or should I use UI images, make them transparent at those spots and put box colliders around them? For me it's easier and faster with the sprites but maybe it is more efficient with images.
enter image description here
Wall is a square on layer 0, capsule is on layer 1 and the square representing the ground is on layer 2 so it can hide the last part of the cylinder. Is there some more efficient way you could recommend me to use? Thank you.
UIImage is a UI element that exists on a Canvas. UIImage is best used as a part of the user interface (UI), e.g. Buttons, overlays and so on.
In your case, the castle is an object in the game world, so it is better to use Sprite Renderer, as the other objects in the game will probably exist in the game space, not UI space, as well.

Custom 2D Lighting System in Unity

Ok so I've been trying to make a custom 2D lighting system in Unity, and I'm at that annoying stage where I know what I want to do but I'm not sure how to do it.
Here's the plan:
There will be dedicated light objects with their own meshes. These meshes determine the shape of the light.
Before the camera renders the whole scene, it does an extra render of just the light meshes with a black background to create a lightmap.
Then the camera renders the scene as normal (does NOT render the light meshes this time). Every object has a shader that will access the lightmap and shade itself appropriately depending on the color of the lightmap at that point.
That's the idea anyway. I sorta threw together a botched form of this. I used a separate camera to render the lightmap into a render texture with a culling mask so that it only rendered the light meshes, which are on their own layer. I then manually passed that texture to the shaders which use their screen uvs to sample from it.
This works sorta ok, but the scene view is completely messed up since it tries to light things as if you were looking at it from the perspective of the lighting camera. I feel like this would make the system hard to use, so I want to try to make some that feels a bit more cohesive.
Here's some screenshots to explain:
The tan-ish box is my "light," which gets rendered to the light cam, visible in scene. This next shot is what renders to the lightmap:
The black background is not from the big black box, the clear flag is just set to Black.
Now according to this lightmap, the middle of the screen should be lit up. and that's exactly what happens:
Notice that in the game view, since the light camera is set up with the same position/rotation/perspective settings as the game camera, it looks fine:
The main problem is figuring out that extra render. Is there anyway to create an extra pass for the main camera before the scene render that only renders the light meshes? I could probably figure out the rest from there. It would also be nice if I could make the lightmap a global shader variable, that way I don't have to pass it to each individual material, but one thing at a time, right?
Thanks so much to anyone who can shed some light on this subject. I'm still pretty new to shaders and rendering, so any help is much appreciated.
If I understand correctly, your problem is the appearance of your lights in Scene View, right ?
For that, you can create a custom Gizmos for them and hide the original objects. There's a tutorial:
https://learn.unity.com/tutorial/creating-custom-gizmos-for-development-2019-2#5fa30655edbc2a002192105c

Custom skybox shader for tiled skybox

I am new to writing shaders. I want to use a texture for 6-sided skybox in unity and I want that texture to be repeated several times also called tiling.
But the default 6-sided skybox shader in unity doesn't have tiling option. Can anyone write a custom shader for 6-sided skybox in unity which has option to tile textures? I also want an option to apply a color tint on the texture if possible. Thanks in advance.
Tiling can be achieved by multiplying texcoord by the number of tiles you want. Or in Surface shader it's uv_YourTex (likely MainTex) instead of texcoord. Writing from a phone so can't post an example, but it's really just one multiplication.
I don't know your specific scenario, but I needed to get more detailed sky with not very detailed texture and instead of UV I used view direction to sample a texture. It made it look like clouds in the distance are further away + clouds can move as you move . It's in this asset.
View direction sampling will not help if you are trying to make space though, which seams to be the case.
Also IMHO tiling on the skybox might be too visible.

unity3d: Adding half-transparent video with shadows

I'm struggling with an issue that might seem a little bit awkward.
I have some black & white 2d animation (1440x1080px) that I'd like to be played in in a 3d environment in unity3d. Therefor I added a video player to a plane. Now comes the tricky part: I want to make the black areas of the video transparent while the white areas remain visible AND the white areas shall cast shadows on the surrounding. Using the particles shader "additive" does half of the job. But I just can't manage to let the video cast a shadow.
If it worked you would get some 2d "antagonist" (you can't interact with) that looks kind of 3d. Alternatively you could interprete it as some half materialzed holograph that casts shadows.
Is there any (simple) solution I just don't know?
Here some schematic drawing of what I would like to achieve, for better understanding.
The problem right now is: In contrast to my drawing, the desired shadow on the wall doesn't appear... :-/
So, I did never try this but you can maybe add a light in the scene just in front of the video player, that way the light will cast shadows.

How to achieve Terraria/Starbound 2d lighting?

I am making a 2d game in the perspective of Terraria/Starbound. I want the lighting to look similar to this:
Ive tried to get lighting like this by adding a material on all the sprites in my game and then giving them a sprite diffuse shader. Then I made a point light wherever I needed light. There where two problems with this though: 1) Where the light was most intense, it was draining the color of a sprite and made it lighter. 2) I noticed a big FPS drop (And I only had 1 point light!).
Is there any way of achieving lighting like this without having to write my own lighting engine? Ive search the asset store and Ive searched to see if unity has any way of handing 2D lighting from this angle but I have found nothing.
If I do have to write my own lighting engine, would that be to complex for someone who is relatively new to unity and has only had ~ 8 months experience?
Assume you are using tile map.
You need to have a field of view map, which can be achieved by reading this: http://www.redblobgames.com/articles/visibility/
Using such map, you know exactly the color tinting for each tile. Now, just blend the color to the SpriteRenderer of every tile on the map.
Somebody already created a line of sight plugin:
http://forum.unity3d.com/threads/light-of-sight-2d-dynamic-lighting-open-source.295968/
Here's my hacky solution on GitHub
There's 2 cameras.
Empty tiles on the tilemap are filled in with white blocks (only one camera renders this)
A gaussian blur is applied to the camera rendering the white blocks
Then, blend the two cameras, darkening everything not covered by the white blur.
You can adjust the "light" penetration by changing the white tile's sprite's Pixels Per Unit.