Home Technical Talk

GTA V Style light bulb LOD

polycounter lvl 6
Offline / Send Message
Pinned
D4N005H polycounter lvl 6
Hello.

After reading the "Lights" section of this article, a question is rised.
The article briefly says that each light mesh has a LOD that consist of a 32x32 sprite. The sprite is then shows up when player goes far away from the light mesh.
httpwwwadriancourregescomimgblog2015gtavb01_bulb_beforejpg
httpwwwadriancourregescomimgblog2015gtavb02_bulb_wireframejpg

httpwwwadriancourregescomimgblog2015gtavb01_bulb_afterjpg
(Credits for the photos: Photos are by Adriancourreges.com)

The question is, how to put the small 32x32 images into the scene? I tried to make a mesh and put an Emissive Shader on it and then make it as a LOD level 2 so that it can pops up when the player is far away, I also added a "Transform.LookAt(MainCamera);" script to it so it always faces the main camera. But it is just doesn't work well and totally worse than what GTA V does.
Here is what I did:

(This is technically a try to recreate those yellow polygons but I think they are made in a shader and not just the way I did, apparently.)

I'd be happy if someone could just help and write some hint about how to do so for the lights LOD as same as GTA V.

Thanks in advance.

Replies

  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    If you take a look at the screenshot with the wires, you can see that all of those polygons has roughly the same size regardless of the distance, so I assume by that 32x32 they doesn't refer to the texture resolution, but the screen space that it takes. So then you'd need a sprite that adjusts its scale so its always 32x32. You may also want to disable mipmaps on this texture so it won't decrease the resolution - fade into 1x1 resolution after distance.

  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Obscura said:
    If you take a look at the screenshot with the wires, you can see that all of those polygons has roughly the same size regardless of the distance, so I assume by that 32x32 they doesn't refer to the texture resolution, but the screen space that it takes. So then you'd need a sprite that adjusts its scale so its always 32x32. You may also want to disable mipmaps on this texture so it won't decrease the resolution - fade into 1x1 resolution after distance.

    Well in the article it is been said that it is 32x32 and then a 32x32 pixel texture is next to the statement. So don't you think it is a size of the texture? if no, then the problem would be how to setup the sprites in a way that they place exactly in the same position that the actual light meshes are, and also the other issue would be how to use render pass/fails so that the lights that are behind  an obstacle wouldn't have the sprite. I hope I've written clearly, though.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Occlusion culling should automatically do that for you.
  • D4N005H
    Offline / Send Message
    D4N005H polycounter lvl 6
    Obscura said:
    Occlusion culling should automatically do that for you.
    Ah so it would be easy somehow. Thanks.

    The one and only thing I need is, how would I be able to make a screen space shader that shows a texture 2D in the same screen position as the 3d mesh is in world space position (obviously I'm talking about X and Y axis). Thanks for the fast replies.

    EDIT: I found Unity's default Halo effect can do what I've mainly talked about here (with some modification,though).
    However, I'd be happy to use a custom shader for it instead, so I may make a custom shader for it, if possible.
Sign In or Register to comment.