Blending more than 3 materials in Unreal Engine 4 - unreal-engine4

I'm trying to make an auto landscape material with 4 materials. If I use 3 materials it blends as expected but if I try blending a 4th I get the default texture when I compile. There are no compilation errors.
The really odd thing is that my normal maps and displacement maps still blend properly. If I put a solid color into the base color output and light the scene I can see that the materials are where I want them to be, but if I put the blended base color I get the default texture with no normals/displacement.
Is this expected behavior or is it a bug? I'm not using landscape layer blend since I want to set the masks procedurally.

I solved this. If anyone is looking for a solution to this, the issue was I needed to set the sampler source to "Shared:wrap" on my texture samples.

Related

How do i make a 3d game pixel perfect? so that there is no anti aliasing or other filtering applied

This is what the game looks like in the 'game' window in unity, which is what it should look like https://ibb.co/xjst4vw achieved by removing all lighting including ambient lighting.
And this is what it looks once built https://ibb.co/4RcbMv8
Why is there a haze in the border between colors? How do I get it to be pixel perfect?
The aspect ratio of the in editor display is 160x144
I have change the game resolution by going to >edit >project setting >player and changing the height and width to the right size
The camera is also passing to a render texture which is of the right size, with the filter mode set to point.
I cant figure out what is causing this. to my knowledge All lighting is turned off. It looks like some up scaling error or maybe some sort of anti-aliasing effect which has also been turned off everywhere i could find.
Does anyone have an idea about what might be causing this? thanks.
There is postprocessing window in unity where you can specify such things like antyaliasing and so on. I think that this will make your game pixel perfect.
Found the answer to my own question the resolution in the >edit >project setting >player >resolution and presentation need to be as high res as it can be so in my case for a 1920x1080 screen it should 1120,1008 which is 160x144 scaled up by 7.
Then send data from you're main camera to a render texture that is set to the resolution you want (in my case 160x144) and create UI canvas that takes up the whole screen and a raw image as a child. Then put the render texture you created in the texture.

Unity 2D shader graph not correct colored

I tried to create outline shader for my Sprite:
I watched tutorials on YouTube (CodeMonkey and Brackeys) about this, but it worked by half. In Scene Graph I see preview:
But outline color I so faded:
And also I can't see this shader on Scene Preview:
What am I doing wrong?
Thanks for your attention
P.S.: Of course I set render pipeline like on this video
P.P.S: Material settings:
P.P.P.S: Shader file
Ok first of all you hadn't set the color in the according Outline Color slot int he Material settings.
Then what you are using is Add which results in additive color combining towards white.
Since your original texture isn't fully black but grey-ish the outline color is added to the already existing color(s) making it also lighter!
Instead you could use a Blend node and re-use the output of the Substract node as blend texture (Opacity).
Then you have to play a bit with the mode but I think maybe Overwrite or PinLight would be what you want.
(Actually you wouldn't need the additional Multiply node for the Outline Color)
Btw before you added your file I just reproduced one from scratch and it is way less complex than yours ;)

Skybox affecting sprites

The default skybox affects the sprites colour. I'm not sure how to stop this from happening. You can see below that the outline of the sprite is brown instead of grey.
If I set the main camera clear flags and background to Solid colour & black respectively, the brown from the skybox still shows through.
I'm not sure what information would be useful for others to assist me with this, so if there is any info I can add, just let me know and I'll update accordingly.
What you're seeing here is alpha blending, your 'outline' pixels have low alpha, so when rendered Unity will blend their color with the background. It generally represents transparency, but in this case it's behaving as a kind of anti-aliasing (it makes your sprites look smoother and less pixely) In that sense, it's working as intended. Look at your sprites at normal resolution and you'll notice they should look good.
If you prefer the pixelated look and really don't want this behaviour, you need to edit your sprites to have full alpha on those pixels.
I'm not sure about Empty's answer:
Are you using the standard shader? That shader uses the environment map as an ambient color on top of the diffuse color (albedo). This is perfectly normal behaviour and makes colors of everything blend nicely with each other. (with an orange sky white objects will look onage-ish. ) This is part of "physically correct lighting" (PBL). It is not at all physically correct, but it comes close enough for now.
If you don't want the environment to affect the colro that mucha you could either alter the environment map to a less dramatic color (normal blue/white sky) or use an unlit shader/material.
Window->Rendering->Lighting Settings
Under Debug Settings, select Generate Lighting.
De-select Auto Generate.
From the Baked Lightmaps set Lighting Data Asset to None.
Remove generated Lighting from the project.

Projecting texture without adding border to it

I have a problem when using the projector with an image as a texture. How to set wrap mode neither to repeat nor to clamp texture?
I want to get this:
and not this:
(Images are from this tutorial)
I run into few solutions to this problem and all of them use Advanced Texture Type which is not available in newer versions of the Unity.
"...What you'll want to do in that case is go to your texture, change the type from Texture to Advanced..."
Is there any replacement for that problem?
EDIT:
As #Gunnar B mentioned, I haven't realized that in the tutorial 1px border is used, so selecting Advanced is not a solution to the problem.
So my question is how to get projection as seen in the first image without adding the border?

Unity - Render Texture from Camera's targetTexture produces seams

I am attempting to render a specific section of my scene using a separate camera, and a render texture. That object is on a separate layer that the main camera is not rendering, but a separate camera is. The secondary camera has a target texture set to be a render texture that I have created. Everything is working as intended except for the fact that the object, when rendered to a texture, has a bunch of seams that are not present when rendering directly to the screen.
What it looks like when rendered directly to the screen:
Correct
What it looks like when rendered to a texture, and then displayed on a quad in the scene:
Incorrect
Notice how the second image has a bunch of transparent "lines" in between the sprites where there shouldn't be any.
I am using a basic transparent shader to display the render texture on the quad (since the background isn't part of the render texture, just the black crowd part). I have tried a number of different shaders, and none of them seem to make a difference.
The render texture's settings are: Width: Screen.width Height: Screen.height Format: RenderTextureFormat.ARGBFloat;
Unity Version: 5.2.3f1 - iOS Platform
Note: The reason I am doing this is so that I can apply a "Blur" image effect to the texture, and make the crowd in the foreground appear to be out of focus. Any alternative suggestions for how to do this are also welcome.
I'm not quite sure -- but it almost sounds like you have line ghosting. You may want to give this a read and let me know if that's what you're dealing with or not:
The reason for this is due to how the texture image was authored, combined with the filtering that most 3d engines use when textures are displayed at different sizes on screen.
Your image may have coloured areas which are completely opaque, coloured areas which are partially transparent, and areas which are completely transparent. However, the areas where your alpha channel is completely transparent (0% opacity) actually still have a colour value too. In PNGs (or at least, the way Photoshop exports PNGs) seems to default to using white for the completely transparent pixels. With other formats or editors, this may be black. Both are equally undesirable when it comes to use in a 3d engine.
You may think, "why is the white colour a problem if it's completely transparent?". The problem occurs because when your texture appears on screen, it's usually either upscaled or downscaled depending whether the pixels in the texture's image are appearing larger or smaller than actual size. For the downsizing, a series of downscaled versions get created during import. These downscaled versions get used when the texture is displayed at smaller sizes or steeper angles in relation to the view, and is intended to improve visual quality and make rendering faster. This process is called "mip-mapping" - read more about mip-mapping here. For upscaling, simple bilinear interpolation is normally used.
The scaled versions are usually created using simple bilinear interpolation, which means that the transparent pixels are mixed with the neighbouring visible pixels. With the mipmaps, for each smaller level, the problem with the invisible mixing with the visible pixel colours increases (with the result that your nasty white edges become more apparent at further distances away).
The solution is to ensure that these completely transparent pixels have a colour value which matches their neighbouring visible pixels, so that when the interpolation occurs, the colour 'bleed' from the invisible pixels is of the appropriate colour.
To solve this (in Photoshop) I always use the free "Solidify" tool from the Flaming Pear Free Plugins pack, like this:
Download and install the Flaming Pear "Free Plugins" pack (near the bottom of that list)
Open your PNG in photoshop.
Go to Select -> Load Selection and click OK.
Go to Select -> Save Selection and click OK. This will create a new alpha channel.
Now Deselect all (Ctrl-D or Cmd-D)
Select Filter -> Flaming Pear -> Solidify B
Your image will now appear to be entirely made of solid colour, with no transparent areas, however your transparency information is now stored in an explicit alpha channel, which you can view and edit by selecting it in the channels palette.
Now re-save your image, and you should find your white fuzzies have dissappeared!
Source: http://answers.unity3d.com/questions/10302/messy-alpha-problem-white-around-edges.html
Turns out that the shader I was using for my scene was using "Blend SrcAlpha OneMinusSrcAlpha" for some reason, when it should have been using "Blend One OneMinusSrcAlpha". This was causing objects with alpha less than 1 to make the objects under them become semi-transparent as well exposing the camera's clear colour background.