buildaworldnet / IrrlichtBAW

Build A World fork of Irrlicht
http://www.buildaworld.net
Apache License 2.0
122 stars 28 forks source link

BRDF Explorer project #279

Closed manhnt9 closed 5 years ago

manhnt9 commented 5 years ago

This issue is meant to discuss software functions of BRDF Explorer.

Rendering algorithms will be discussed in #276.

manhnt9 commented 5 years ago

Note: For cloning CEGUI on Windows, Python folder should be added into PATH environment variable. For example it's OK if you can call python from CMD. Python 2 is required for this script to treat Mercurial repo with Git.

Asking approval from @devshgraphicsprogramming and @Crisspl, or else we can download a latest, compressed CEGUI branch before building from these links, but that's a little hard for updating CEGUI.

devshgraphicsprogramming commented 5 years ago

Python 2 (I have 3 but cmake is not finding it) seems to be necessary for some of our SPIR-V dependencies to not create disturbing errors when building with MSVC ( #269 ).

I'm all for Python 2 being a dependency, but please please please make CMake on Windows find it if its installed.

If possible I'd use and require Python 3 instead of 2 and solve #269 with Python 3, not 2.

CEGUI submodule can be a 3rdpart module in ./ext/cegui/3rdparty/ that is conditionally updated by CMake script only if the option is specified that we build the examples (there should really be extra cmake option switches for certain examples that rely on big extensions with dependencies).

P.S. Actually having python as a dependency is totally cool as we plan to do #92 ;)

devshgraphicsprogramming commented 5 years ago

Write main code file to render the GUI, load a simple model

I don't know where you want to discuss the Functionality-but-not-strictly-Rendering aspects of the task, but generally I would expect this issue to cover the parts of the BRDF Explorer LaTeX specification that are functionality.

Speaking of which I would want the intial sample to handle model loading and have a "stub" graphics-pipline reconfiguration function which actually gets triggered (for cases when we change "heavy" material parameters, such as the parameter source [texture vs constant] and BRDF type ).

devshgraphicsprogramming commented 5 years ago

One more note, everything to do with the BRDFExplorer should be statically linked into the binary, we don't want a massive folder of dlls to be necessary.

You have my permission to make irr::ext::cegui as a static library with its own build target, if necessary.

Furthermore, if CEGUI needs some skin, font atlas, or other resource that comes from a file which is not "required for BRDFExplorer only". I think the defaults/built-ins should be "resource compiled". Here's a script that supposedly does so https://github.com/vector-of-bool/cmrc

Again, the XML layout of the GUI specific to BRDFExplorer needs not be embedded in the executable, but the reusable parts I would resource compile into irr::ext::cegui. https://github.com/vector-of-bool/cmrc

manhnt9 commented 5 years ago

I will update my Windows environment (includes MSVC) and test if Python 3 can be used with the Mercurial script.

About the static linking, I've done it before in my engine so I can guarantee. But I suggest we do static linking for Windows only since it doesn't benefit Linux much.

manhnt9 commented 5 years ago

About CEGUI resource, the reusable part will be stored on my CEGUI branch too so we don't need to duplicate those files in irrbaw.

Resource distribution can also be in a single .zip file (with/without password protection) like in @Florastamine's releases before. Do you really want to compile resources into exe?

manhnt9 commented 5 years ago

After reviewing the CEGUI data, I see that there're data which isn't general enough to get accepted into CEGUI's original branch, so it won't stay in my branch too. I'll manage a separate Git repo of the CEGUI data instead since we'll both use them. Nice CMake code to have CEGUI+Data in a build process will be provided.

devshgraphicsprogramming commented 5 years ago

Stuff like the skins (reusable part) etc can go into ./media/ I'm not completely 100% resource compiled ;)

manhnt9 commented 5 years ago

OK, will have them here.

Update about Python and Mercurial bridge stuff. I will configure on my machine to push from my local cegui to a git repo. So I can have single local and 2 different remotes (bitbucket hg and git). It makes the submodule much easier since I realized that in order to clone from Mercurial:

So instead I'll push cegui to a git repo, have done it before and it has perfect sync.

In short, these 2 submodules will be added:

Both git repos are maintained by us on GitLab.

manhnt9 commented 5 years ago

Wasted half a day to try Hg-Git. Met errors on both Windows & Linux. Tags failed = not pushed anything. Issue reported: https://bitbucket.org/durin42/hg-git/issues/276/failed-to-push-tags

Tried again with this: https://github.com/frej/fast-export. Now I have 2 separate cegui folders and have keep then in sync with single command.

Repos are online at: https://gitlab.com/InnerPieceOSS

Integrating submodules into example app.

manhnt9 commented 5 years ago

Capture

manhnt9 commented 5 years ago

CEGUI dependencies now can be downloaded, built and installed to CEGUI. Will write build script for CEGUI tomorrow.

manhnt9 commented 5 years ago

Base project is created. I will spend the day mostly for studying GUI implementation by @Florastamine.

manhnt9 commented 5 years ago

I ported the main window GUI, but fails to compile (https://github.com/buildaworldnet/IrrlichtBAW/issues/294) so I'm waiting for the fix. Next is to port color picker and finalize UI then we can start rendering. Hopefully in this week. P/S: Doing some overall maintenance and test more on both platforms actually.

manhnt9 commented 5 years ago

I meet this on Windows, git doesn't recognize new submodule.

manhnt9 commented 5 years ago

Thought it was a folder so I ignored submodule before. Solved that issue.

devshgraphicsprogramming commented 5 years ago

Install CEGUI headers to INSTALL_PATH/include/irr/ext/CEGUI

I thought you meant only the CEGUI extension's headers, i.e. the headers which are supposed to be public in irr/ext/cegui (required for compilation of binaries and libraries using it)

manhnt9 commented 5 years ago

ext will only help you set up. In order to develop GUI, you'll have to use CEGUI API too.

devshgraphicsprogramming commented 5 years ago

ok, but then: INSTALL_PATH/include/irr/ext/CEGUI is for your own headers INSTALL_PATH/include/irr/ext/CEGUI/some/other/path is for cegui's headers

manhnt9 commented 5 years ago

Some initial render, still has layout bug of my port I guess. Will have more updates soon.

cap

manhnt9 commented 5 years ago

Ah the layout is fine, just lacking windows because those are still not ported. Great! Also task list is updated.

manhnt9 commented 5 years ago

This could be a bug actually, I double-checked it in CEED. It should be like this (screenshot from CEED). Gonna have fully working main layout first before continuing. What should be done next is to compile the old GUI demo, disable some code and compare with irrbaw app.

Screenshot_2019-05-13_16-56-19

manhnt9 commented 5 years ago

Fixed by @devshgraphicsprogramming 's suggestion on Discord. This is about OpenGL/Vulkan NDC. Mouse input works, will test key input too.

Screenshot_2019-05-14_22-34-55

devshgraphicsprogramming commented 5 years ago

@manhnt9 does this help you with your Saga3D renderer?

manhnt9 commented 5 years ago

Oooh, absolutely. Thanks for reminding me about that. I don't remember solving any NDC issue and also my GUI is disappearing somehow. Gonna revisit it soon.

manhnt9 commented 5 years ago

Mouse and key are working fully.

manhnt9 commented 5 years ago

All Sliders, Click to browse events and File Dialogs are working.

Screenshot_2019-05-15_15-45-04

manhnt9 commented 5 years ago

Dropdown works. Screenshot_2019-05-15_16-12-45

manhnt9 commented 5 years ago

GUI is 99% done. Next step is to re-test as much as possible and do the rendering. Then connect GUI data to graphics pipeline.

manhnt9 commented 5 years ago

All GUI controls are tested, working well. Gonna test on Windows.

manhnt9 commented 5 years ago

I'm gonna refactor the build process for CEGUI first then solve pending comments later.

manhnt9 commented 5 years ago

We have perfect build now, Debug/Release works, CEGUI projects are built before building IrrExtCEGUI. Also found a bug about disappearing cursor in file dialog and fixed it. App has 2 overlapping cursors, CEGUI cursor and native cursor. Native cursor is now only visible for file dialog.

Capture

manhnt9 commented 5 years ago

Base project is considered done to me. From now we can add new code consistently. CEGUI's dependencies will be upgraded later when the Ext is widely used in examples then I'll change it to submodule instead of download and build from .zip. Hope that by the time CEGUI is already moved to Git too.

devshgraphicsprogramming commented 5 years ago

so do we close this issue?

manhnt9 commented 5 years ago

Still have sRGB tasks left.

manhnt9 commented 5 years ago

Next week I'll merge with the loaders, write the image codec for CEGUI, make CEGUI upload textures in SRGB format.

devshgraphicsprogramming commented 5 years ago

Maybe we should remove the following from the checklist

More rendering features based on #276

so at least we can close issues

devshgraphicsprogramming commented 5 years ago

if IrrBaW will provide texture loading abilities to CEGUI can we kick out STB, etc?

devshgraphicsprogramming commented 5 years ago

can you guys manage to fix the crash when the titlebar of the color picker is double-clicked? (or at least disable any sort of reponse to a double click)

devshgraphicsprogramming commented 5 years ago

@Crisspl would it make sense to get around our texture flipping issues with:

Then we kick out STB and not build the CEGUI texture loading lib.

@Crisspl and @Przemog1 at your leisure:

The last two things would be modifcations of the CEGUI submodules which would have to be diff'ed (with your favourite diff tool) into a .patch file that we submit to @manhnt9's branch of CEGUI (since his git repo is kind-of a mirror of a mercurial repo, yes CEGUI people use Hg)

Crisspl commented 5 years ago

would it make sense to get around our texture flipping issues with: Implement IrrBAW CEGUI texture loader in ext namespace

You'd have to elaborate. The only solution im almost sure will work is to separate CEGUI textures and irrbaw textures on the level of GL objects. Still i can't be 100% sure because it also became apparent that this weird behavior affects also textures that cegui doesnt even know about (but simultaneusly there are some shared between irrbaw and cegui). However it worked (textures wasnt flipped) when there was only GUI - no irrbaw textures were shared with cegui nor created at all

devshgraphicsprogramming commented 5 years ago

To be fair I don't even know how on earth CEGUI could flip textures in the main render window.

It does make most sense for CEGUI textures and our own textures to be separate objects. (Unless we provided our own GUI Renderer to replace OpenGL core one)