I've been Experimenting with GPU Instancing to draw 1,60,000 Meshes and Unity's Graphics API has some really Good Functions to achieve this.
I am currently using Graphics.DrawMeshInstanced and I get the Meshes on the Screen, However, these Instanced Meshes only react to Directional Light, and not to Point/Sport lights. Is this a Limitation that cannot be overcome or am I missing Something here?
I am currently using an Orthographic Camera with Forward Rendering , and Unity's Standard Shader for the material. If It helps I am trying to make a Simple Rimworld like game.
With Directional Light
With Point/Spot Lights
Related
To be more precise I need a type of lighting that looks good to put on building models that already have a texture, I can't texturize the textures with light turned on apartments such as in GTA5 because I do not know how to create textures. I tried putting point light and spot light on buildings but it looks pretty bad, neon cubes are not good either as it makes the building look back.
I hope you understand what I meant.
Like that but no texturization
To achieve the results in the image, you should use an emission map.
Creating these types of lights using the Light Component is inefficient. You must not Spot Light OR Point Light for this purpose.
SOME YOUTUBE VIDEOS:
How to TURN ON Lights in Unity
How to Use EMISSIVE MATERIALS in Unity! Step-by-Step Tutorial
sorry if this is a noob question, is there a way to combine Unity shaders made using the Shader Graph with sprites? I would like to use the normal map attached to the texture to assimilate a 3d mesh, so that I can use some more advanced Shader Graph nodes (e.g. Fresnel).
It seems that the 2d shader examples online work only on the dissolve effect, character outline, tint changes, ... and I cannot find anything on using the highlights/lowlights already present in the 2d art to make it behave like 3d. I also have not found any examples of more complex shader effects that work on 2d. Any input would be greatly appreciated.
To give a more specific example, could this shader be adjusted to apply to a sprite?
https://www.youtube.com/watch?v=Cl4wkGjtGgw&list=PLkADxCB_xHGkE3iguVxNOStONQoidH4sr&index=3&t=3s&ab_channel=PabloMakes
I placed a light in my scene.
It is lighting the ground when i'm facing that light but when I turn the opposite direction, the light on the ground vanishes.
I think this might be some Unity's default behaviour.
Is there a way I can solve this issue?
Unity uses frustum culling to save performance, so it only draws items that are within the camera's viewing area. As a result of this, the particles behind you are not drawn, and any lights attached to them aren't either.
Scene-crucial lights aren't normally attached to particles, so it's normally not a concern if they're hidden along with their particles.
For conventional lights (not attached to particles), Unity should render the light as long as it affects objects within the camera frustum. If you use a conventional light, you should see better results.
Looks like you may have to disable occlusion culling. Unity3D Manual
How do I create this lighting effect in HaxeFlixel or Unity ?
I will tell you how it was created in this specific case. This question is very broad and there are very many ways to create lighting effects in both Unity and HaxeFlixel.
The image is of the game Beneath the City by Deepnight, accessible on his website. The game uses haxe although not with HaxeFlixel. It's deepnight's personal engine that works with the flash target. The source code is available here. The class where lighting takes place is in src/Level.hx and more specifically in the renderLights method. From what I gather, a light layer is layered above the sprites of the level. This layer (or bitmap data) has lights drawn as rectangles on it. This layer is then blurred, so that the lights don't appear as solid rectangles, but as faded blurs of spreading light. This takes place with flash blur filters. Blend modes are used to make the light Add in luminosity. A dark mask is then layered above the blur layer, presumably to prevent light in certain locations, such as in the fog of the game. (?). This all takes place between lines 208 and 248.
This game truly does have gorgous visuals, but the lighting goes beyond the initial blurred lights. Particles float around in the game that really add to the lightings aesthetic.
This is all how he does it though. How you do it is up to you. For HaxeFlixel, I would first consider alternatives such as this geometric lighting or this method of applying lighting to scenes, which looks closer to screenshot or even a very simple circle based lighting alternative. Searching Unity 2D lighting brings up plenty of options.
You've got plenty of options on how to approach the issue. I didn't answer this with a direct tutorial because the question isn't at the code level.
I'm making a FPS game in Unity, and I want the environment to light up as the player is shooting on his environment.
So say I have a tree. First it would be entirely black or greyish, but if I shoot somewhere, I would see some green.
To accomplish this feature, I'm using a raycast to have the impact point and so I can access any renderer of the point that the player is shooting on.
I guess the next step would be to write a custom shader to light the exact pixel that is shot.
Do you have any idea how I could write this shader or another way of doing this effect?
Regards
If you are using deferred rendering: Deferred decals.
If you are using forward rendering: Projectors.
If you need some more advanced "paint-like" functionality, use render textures coupled with RaycastHit.textureCoord to get the exact UV coordinate at your ray intersection point. You can draw stuff to render textures using Graphics.Blit. Check out this github project for some inspiration on how to do this.