Jump to content

Camera Layers


Brutile
 Share

Recommended Posts

Not sure if there is something already in Leadwerks to do this, but I would like something similar to Unity3D's camera layer system, where you could set an object (like a gun) on a layer that the camera could cull. You could then setup two cameras, one that renders the environment, and another that just rendered the gun. This would be helpful in stopping weapons passing through walls, and would also allow higher FOV without making the gun look stretched and horrible.

  • Upvote 1
Link to comment
Share on other sites

I think multiple worlds is a good way of doing things, but I still think you shouldn't need to use textures and buffers. There should simply be a way of culling the background of a camera, then rendering the two worlds.

Link to comment
Share on other sites

Not sure if there is something already in Leadwerks to do this, but I would like something similar to Unity3D's camera layer system, where you could set an object (like a gun) on a layer that the camera could cull. You could then setup two cameras, one that renders the environment, and another that just rendered the gun. This would be helpful in stopping weapons passing through walls, and would also allow higher FOV without making the gun look stretched and horrible.

That's actually a bad example because if the gun penetrates into a surface, even if you hack it to appear on top, the surface's shadow will still be cast onto the gun. (This occurs sometimes in STALKER, at least the first one.) My solution was to scale down the weapon to a very small size and put it right in front of the camera. You still get the nice environment shadows cast onto the visible weapon, and it doesn't penetrate walls.
  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I think it's a bit of an exaggeration to call that a nightmare. wink.png

 

Another option is to make it so the gun is rotated up when it is close to a wall. They did this in Crysis, and I think even Dangerous Rays has this behavior. I saw another game where the gun would just get rotated downwards out of view when close to a wall, maybe it was Doom 3? That would be a nice feature to add to the player script.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I have pretty tame nightmares :). Probably 15 mins of trial and error of scaling, test, get pissed, rinse and repeat.

 

That rotate downward was a video posted here that some made with LE. It did look nice. It was in 3rd person but I'm sure it works in 1st too.

Link to comment
Share on other sites

So, Josh, is it really intended, that you can't simply render two different worlds/cameras, etc. over one another (with alpha)? I think, the ability of doing that was a great feature in LE2.5. Especially the ability of rendering first only the layers without lighting and then AFTER that rendering the lighting seperately (calculated only once from screen-space, as explained in your own document: http://www.leadwerks.com/files/Deferred_Rendering_in_Leadwerks_Engine.pdf). (The part about the lighting is really important for performance). The lack of this would be quite a drawback, imho.

Link to comment
Share on other sites

I have pretty tame nightmares smile.png. Probably 15 mins of trial and error of scaling, test, get pissed, rinse and repeat.

 

That rotate downward was a video posted here that some made with LE. It did look nice. It was in 3rd person but I'm sure it works in 1st too.

Hahaha... At work we searched for (as it was discovered) a misplaced '.' character for two weeks. THAT's a nightmare :D

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

smile.png I have more patience for bugs than I do scaling trial and error it seems because a bug is a mistake and I accept that. Scaling like this should be easier and real-time to make it more efficient. I could have probably set something up for that, but either I write 30+ mins of code to do that or I suffer 15 mins of rescale/restart to find the exact value. I picked the trial and error just to something.
  • Upvote 1
Link to comment
Share on other sites

  • 5 years later...
11 hours ago, ErhanK said:

What if i want to render extra 3rd person character mesh that is casts only own shadows and it's not visible by main FPS camera? How i can make it?

Create a custom shader that discards every pixel.

  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Oh yeah, I guess you could use a shader with alphamask enabled and just set the alpha component of the entity color to zero.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...