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

Access to last frame's matricies #12

Closed
CptPotato opened this issue Aug 29, 2019 · 7 comments
Closed

Access to last frame's matricies #12

CptPotato opened this issue Aug 29, 2019 · 7 comments
Labels
enhancement New feature or request

Comments

@CptPotato
Copy link

CptPotato commented Aug 29, 2019

I tried playing with temporal filtering in this app but quickly ran into the problem that there's no way to get data (variables) from the previous frame. It would be neat if there was a way to access the last frame's matricies, which are needed in temporal reprojection algorithms.

To select them they could simply be added to the list in the variables window:
grafik

On a different note, inverse matricies are also often used in shaders. It would be nice if they were available aswell, but it's not a big issue since they can be calculated in the shader.

@dfranx
Copy link
Owner

dfranx commented Aug 29, 2019

Thanks for the suggestion! I will implement this tomorrow (and the binary will probably come out on sunday/monday) as unfortunately I don't have time to program today.

I was thinking maybe adding some kind of checkbox that takes values from the previous frame when checked would be a good way to solve this (instead of adding bunch of "LastFrame*" variables + this way you can get every existing 'system' variable's value from the last frame).

And I would probably do the same for the inverse matrices - a checkbox that inverses the matrices when checked.

This would be quite easy to implement. Opinions?

@CptPotato
Copy link
Author

Sounds great to me. No reason to rush, though 😄

@dfranx dfranx added the enhancement New feature or request label Aug 30, 2019
dfranx added a commit that referenced this issue Aug 30, 2019
@dfranx
Copy link
Owner

dfranx commented Aug 30, 2019

Hey! I have just published the binary with all of the suggestions you made. Could you please test them so that I can close the issues? I would test them myself but I currently don't know how to utilize those features properly heh. Also could you post some screenshots in the "Post screenshots here" issue? I'd love to see some cool shaders built with SHADERed! :D

@dfranx
Copy link
Owner

dfranx commented Aug 30, 2019

Also, I forgot to make the checkboxes for the flags visible but you can still use them. The UI for flags should probably change completely in the future - although I don't know what would make it look better and more simple

@CptPotato
Copy link
Author

CptPotato commented Aug 31, 2019

So I tried it and the view-projection matrix works fine with this feature but geometry transform somehow doesn't.

Edit: weird, on a clean project it works.
Edit2: looks like it has something to do with using these last frame properties and having multiple objects in the scene.

@dfranx
Copy link
Owner

dfranx commented Aug 31, 2019

Oh I didn't think about that. What's causing this is that I actually have only one matrix which is used to store all the geometry transform. So before each rendered item I update the matrix to store that item's transform... and then after I copy the value, I actually copy only the last rendered item's transform matrix. There are also probably other values that wouldn't work (the only I can think of right now is the viewport size when each shader pass is rendering to different sized viewport). I'll have to rework that..

@dfranx
Copy link
Owner

dfranx commented Aug 31, 2019

Fixed!
Also, I disabled the last frame flag for viewport size - don't see the practical use for it and don't want to change half of the code currently. I will leave that disabled until I start working on a support for multiple cameras.

@dfranx dfranx closed this as completed Aug 31, 2019
AlvaroRuizDelgado added a commit to AlvaroRuizDelgado/SHADERed that referenced this issue Dec 21, 2019
* Cross platform update

* Minor CMake changes

* Use inotify for file watcing on linux

* Fix for dfranx#5

* Fix GLSL shaders + fix for a bug that occurs when using multiple textures

* Add steps for Windows in the README

* Add FindGLM.cmake

* Variable pointers

* Small fix for variable pointers

* Shader macros

* fix sdl linking on Linux

* Update CHANGELOG

* Fix for dfranx#13

* Add FrameIndex system variable dfranx#14

* Add option that disables RT clear dfranx#15

* UIHelper -> include clocale

* Shader variable flags dfranx#12

* Fix CopyState() crash

* Fix last frame flag for GeometryTransform dfranx#12

* Disable last frame for IsPicked + change var manager default size

* Icons

* Add format property to render textures dfranx#17

* Add toolbar

* Add elapsed time to status bar + make the toolbar buttons work

* Pause and increase time

* Fix float4/int4/bool4 variables

* Add Mouse and MouseButton system variables

* Zoom in/out functionality

* Zoom controls

* Fix RT filtering and model rendering

* Fix a bug where SHADERed would crash with multiple 3D models dfranx#18

* Replace glm::identity<glm::mat4>() with glm::mat4(1) dfranx#6

* Add option to reset time

* Fix zoom area dragging & limit zoom selection bounds

* Add CTRL+ALT+MWheel to zoom in/out

* Add FindSFML.cmake

* Add USE_FINDSFML variable

* Add cubemap preview

* Fix picking when zoomed in

* Improve gizmo, bounding box & zoom area performance

* Add option to modify system variables when rendering to an image

* macOS changes

* Object preview window

* Fix CMakeLists.txt

* Add proper cubemap and audio preview to the object preview window

* Add buffers

* Add instancing

* Add ability to use buffers as inputs for instanced objects

* Fix 3D model instancing

* Make it compilable on windows

* Add auto check for updates on startup

* Add buffer to toolbar & minor improvements to UpdateChecker

* Update TextEditor dfranx#19

* Add show whitespace option

* Update external libraries

* Add auto recompile option - compile changed shaders every 200ms

* Add option to disable window's alpha channel

* Add ScreenQuadNDC

* Add the ability to set CodeUI.Save and Project.Save to same shortcut

* Add option to stream logs to file

* Bump version

* Fix loading files from different drives on Windows dfranx#18

* Add ImageObject

* Add compute shaders

* Compute shader examples + fixes

* Minor changes

* Update README.md & TUTORIAL.md

* Fix README gif

* Remove some gifs

* Fix crash on RWTexture2D

* Fix crash on HLSL function calls with no arguments (update glslang)

* Fix various transcompiler crashes

* Various TextEditor fixes (check CHANGELOG) - update ImGuiColorTextEdit submodule

* Fix a bug that occurs when fetching texel data from a texture without a sampler

* Write item type in the properties

* Use different color to write shader pass with an error in the PipelineUI

* Disable various path textboxes

* Prevent pause button from overlapping

* Update TextEditor, add hlsl compute example, bump version

* Add Vulkan GLSL support dfranx#21

* Minor fixes

* Add input layout (dfranx#25)

* Exporting/importing shader pass input layout

* Add input layout manager

* Fix tangents and bitangents

* Add option to export a sequence of images dfranx#23

* Improve performance mode dfranx#24

* Various fixes & changes

* Add CameraPosition3 and CameraDirection3 variables

* Add drag & drop

* Add 'Are you sure?' message box

* Multiple bug fixes

* Rework ImageObject & fix ScreenQuadNDC rendering

* Add resource manager

* Add CTRL+F/search box in the text editor

* Fix for dfranx#27

* Fix a bug where SHADERed would recompile file two times after clicking Compile button

* Add ability to change variable type after variable has been created

* Add a window where all system variables are listed

* Add magnifier tool to object preview window

* Make it so that any form of project save also saves all shader code modifications

* Shader code modifications now also count as project modifications

* Minor changes

* Add context menu and replace feature in the text editor & fix copy and paste functionalities

* Some internal changes to the magnifier tool in ObjectPreviewUI

* Detect if some Editor shortcuts are missing

* Remove all the maps from ObjectManager

* Fix for gcc

* Fixes

* Add support for HLSL types in the buffer format

* Recompile shader pass after we change it's shader path

* Add ability to change warning, message and error text colors in the theme files

* CodeEditorUI now holds pointers to PipelineItems

* Close code editors after a shader pass has been deleted

* Add feature that automatically creates variables when creating a shader pass

* Add Editor.FindNext & improve text editor find feature

* Add 3D textures

* Add Project -> Options

* Fix 3D textures

* Fix texture loading

* Add various checks to prevent crashes

* Add multi-camera system (+ ShadowMapping example) & fix matrix variable export/import

* Update readme

* Add audio shaders (+ audioshader example)

* Update libraries

* Update TODO.md

* Fix a bug where openning Sobel -> Edge -> Sobel examples would break the rendered

* Fix a crash on openning 'cubemap' example

* Update README.md & settings.ini

* Improve image sequence export speed & add ability to use sprintf format specifiers in filename (dfranx#23)

* Add Fedora Dependencies

* Scroll to the selection & fix FindNext highlighting

* Update TODO.md

* Fix Editor.Find and Editor.Replace shortcuts

* Fix HOME/END shortcuts

* Fix gizmo interaction when preview is zoomed in

* Add drag & drop to PipelineUI

* Bump version

* Add ability to deactivate certain shader pass

* Pausing preview now also pauses compute shaders

* Improve TextEditor shortcuts

* Revert

* Update TODO.md & CHANGELOG.txt

* Fix a bug where TextEditor would lose focus on ALT key press

* Plugin API base

* Fixed missed return ArcBallCamera '=' operator

* Fixed missed return value for '=' operator

* Memory leak fix

```
		if (m_item.Data != nullptr)
			delete m_item.Data;
```
m_item.Data:
https://github.com/dfranx/SHADERed/blob/24ba95faebfde61581a08792b82f5ad2cb13d69f/Objects/PipelineItem.h#L45

it leads to mem leak as 'delete' operator can't delete 'void*' proper. (not type information -> not size data, and no information about destructor, ... )
https://github.com/dfranx/SHADERed/blob/24ba95faebfde61581a08792b82f5ad2cb13d69f/Objects/PipelineItem.h#L45
i.e. destructors of internal fields (ex https://github.com/dfranx/SHADERed/blob/24ba95faebfde61581a08792b82f5ad2cb13d69f/Objects/PipelineItem.h#L78)  won't be executed.

* Mem-leak fix

Base class should have a virtual destructor otherwise delete (UIView*) ... won't be able to call derived destructor (even a default one).

* Add support for #include

* Update TODO.md & minor changes to KeyboardShortcuts (dfranx#35)

* Fix #include's for HLSL

* Fix message line numbers when using #include in GLSL shaders

* Add 'Recursive #include detected' message

* Update default theme & font (dfranx#9)

* Add an option to save supersampled screenshots (dfranx#34)

* Update imgui

* Add search in Options -> Shortcuts

* Bump version

* Add ability to load projects by drag and dropping them

* Toolbar item for openning projects should now also show 'Are you sure?' message box

* Somewhat fix autocomplete and find window background colors

* Update and expand the API

* Hide object view window in performance mode

* Add MSAA (dfranx#36)

* Change how MouseButton works

* Fix a bug where user could select same RT multiple times for the same pass

* Fix camera rotation loading from project file

* Add ability to add custom system variable types

* Check if user doesn't have required plugins for a project

* Add ability to disable certain plugins

* Consistency between auto-recompile and normal recompile when using #include

* Add ability to add custom functions

* Add ability to install SHADERed binaries (dfranx#33)

* make install -> lowercase (dfranx#33)

* Compiles on linux

* Plugins can now add custom ObjectManager items

* Add PipelineItem::PluginItem

* Fixes, improvements & add various plugin functions

* Add GetPluginVersion() & fix bugs

* More fixes

* Update shortcuts.kb

* Add ShowContextItems(pluginitem_add, item_type)

* Add GetDPI, Log, FileExists, ClearMessageGroup to plugin API

* Add GetObjectCount, GetObjectName, IsTexture, GetTexture, GetTextureSize plugin functions + fix pipelineitem_add

* Add XDG desktop and AppData files for Linux integration

This also installs those files in CMake to expose SHADERed
to the application launcher once installed.

* Add BeginRender and EndRender to PluginAPI

* Prevent SHADERed from crashing when plugins directory doesn't exist (dfranx#38)

* Cache PluginItems in RenderEngine

* Add BindDefaultStateFn

* Add ability to check for changes in plugin's custom files

* Plugin API can now access CodeEditorUI features

* Auto recompile now works with plugin items

* Plugin API changes

* Prevent crashes when one of the directories (themes, templates, data) doesn't exist

* Create data directory if it doesn't exist

* Update plugin API

Co-authored-by: Franx <dfranx00@gmail.com>
Co-authored-by: CuriousTommy <CuriousTommy@users.noreply.github.com>
Co-authored-by: Denis <denis.ovod@gmail.com>
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants