Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP : Add-Shadows #600

Open
wants to merge 10 commits into
base: dev
Choose a base branch
from
Open

WIP : Add-Shadows #600

wants to merge 10 commits into from

Conversation

Pradnya2203
Copy link

No description provided.

@Pradnya2203 Pradnya2203 requested review from Bashar-Ahmed and removed request for Bashar-Ahmed December 28, 2022 15:04
@Pradnya2203 Pradnya2203 changed the title WIP WIP : Add-Shadows Dec 28, 2022
@sin3point14
Copy link
Contributor

I obviously have no clue what discussions you people had so take this with a grain of salt:
I think first step for shadows should be to to shift all D3D render target objects to a separate RenderTarget class. If you add them directly to RenderingDevice you'll need to spray it with a lot of if...else block to enable/disable shadows. Also adding such conditionals is against the objective of RenderingDevice which is supposed to be a dumb class that just interfaces with the D3D API. What I think would be nice is to have a function in RenderingDevice that returns a tuple of ID3D11DepthStencilView, ID3D11ShaderResourceView and ID3D11RenderTargetView and that hypothetical RenderTarget class takes ownership of it.
Now CameraComponent will own a RenderTarget in case of no shadows or 2 RenderTarget in case of shadows. An even better part is that you can get a "render to texture feature" for free, just by making the ID3D11RenderTargetView point to a texture instead of screen. Another good thing that could come out of such a design is that only CameraComponent needs to know if shadows are enabled or not and it could take control of the final draw() call. Hence it could call draw once after binding the shadow ID3D11RenderTargetView. Then again after binding the shadow and ID3D11RenderTargetView, Which fits in nicely since there is where little difference between the configuration of a shadow buffer render and final render.
I had these thoughts long back when we were thinking of adding shadows but my memory is hazy and I may have written things that don't make sense anymore. Also this task of "architecting" could be taken up by some 3y probably :p.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants