Brutile 66 Posted May 6, 2014 Share Posted May 6, 2014 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. 1 Quote Link to post Share on other sites
DudeAwesome 87 Posted May 6, 2014 Share Posted May 6, 2014 good idea could also be interesting in combination with post effects per camera. like background black/white and gun tooneffect Quote Link to post Share on other sites
shadmar 1,182 Posted May 6, 2014 Share Posted May 6, 2014 Look at http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/world/ You can render each world seperately using it's own camera. Quote Link to post Share on other sites
Brutile 66 Posted May 6, 2014 Author Share Posted May 6, 2014 Ok, that makes sense and I got it mostly working, but when I render, it will only show the last world that I rendered. It was rendering the background, which rendered over the top of the first one. Quote Link to post Share on other sites
shadmar 1,182 Posted May 6, 2014 Share Posted May 6, 2014 Here is an example which renders skybox as background and the rest as foreground using 2 worlds http://www.leadwerks.com/werkspace/topic/9464-rendering-backgroundsforegrounds/#entry72636 Quote Link to post Share on other sites
Brutile 66 Posted May 6, 2014 Author Share Posted May 6, 2014 Thanks shadmar, that worked, but the objects in the worlds are now pixellated, even with multisampling turned up. Is there a way to fix it? Quote Link to post Share on other sites
shadmar 1,182 Posted May 6, 2014 Share Posted May 6, 2014 Try to add something like this : fortex->SetFilter(Texture::Smooth); fortex->SetAnisotropy(16); foreground->SetColorTexture(fortex); and maybe camera->SetMultisampleMode(2); Quote Link to post Share on other sites
Brutile 66 Posted May 7, 2014 Author Share Posted May 7, 2014 SetAnisotropy gives me a script error: error in function 'SetAnisotropy' argument #1 is 'Texture'; 'Texture' expeced. I'm using Lua. Quote Link to post Share on other sites
Brutile 66 Posted May 7, 2014 Author Share Posted May 7, 2014 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. Quote Link to post Share on other sites
Josh 10,028 Posted May 8, 2014 Share Posted May 8, 2014 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. 1 Quote Link to post Share on other sites
Rick 1,514 Posted May 8, 2014 Share Posted May 8, 2014 I did the same thing Josh did with scaling and it works. However, it was a nightmare of trial and error trying to get the right scale and position. Quote Link to post Share on other sites
Josh 10,028 Posted May 8, 2014 Share Posted May 8, 2014 I think it's a bit of an exaggeration to call that a nightmare. 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. 1 Quote Link to post Share on other sites
Rick 1,514 Posted May 8, 2014 Share Posted May 8, 2014 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. Quote Link to post Share on other sites
Ma-Shell 158 Posted May 8, 2014 Share Posted May 8, 2014 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. Quote Link to post Share on other sites
Roland 503 Posted May 8, 2014 Share Posted May 8, 2014 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. Hahaha... At work we searched for (as it was discovered) a misplaced '.' character for two weeks. THAT's a nightmare Quote Link to post Share on other sites
Rick 1,514 Posted May 8, 2014 Share Posted May 8, 2014 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. 1 Quote Link to post Share on other sites
ErhanK 7 Posted May 4, 2020 Share Posted May 4, 2020 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? Quote Link to post Share on other sites
Josh 10,028 Posted May 5, 2020 Share Posted May 5, 2020 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. 1 Quote Link to post Share on other sites
tipforeveryone 259 Posted May 8, 2020 Share Posted May 8, 2020 Or: just attach a normal character model (a duplicated asset) with this material setting, I used in my project too 4 1 Quote Link to post Share on other sites
Josh 10,028 Posted May 9, 2020 Share Posted May 9, 2020 Oh yeah, I guess you could use a shader with alphamask enabled and just set the alpha component of the entity color to zero. Quote Link to post Share on other sites
Recommended Posts
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.