buildaworldnet / IrrlichtBAW

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

BRDF Explorer GUI #254

Closed manhnt9 closed 5 years ago

manhnt9 commented 5 years ago

We can discuss and update progress on GUI development of BRDF Explorer extension here.

Developer: @Florastamine Adviser: @manhnt9 @devshgraphicsprogramming

Screenshots: to be updated when there's new progress from @Florastamine

Notes after discussion on Discord:

Task list made by @Florastamine:

How to integrate CEGUI into IrrBAW:

How to render CEGUI with IrrBAW: Use this code snippet for GUI rendering

auto renderState = irr::video::COpenGLState::collectGLState();
irr::video::COpenGLState guiState;
executeGLDiff(guiState.getStateDiff(renderState));  
CEGUI::System::getSingleton().renderAllGUIContexts();
executeGLDiff(renderState.getStateDiff(irr::video::COpenGLState::collectGLState()));

See more about how to use IrrBAW's OpenGL state manager at this file.

Notes:

devshgraphicsprogramming commented 5 years ago

This is my provisional and not yet complete list of CEGUI themes I find attractive:

Btw, what does CEGUI use for font rendering?

devshgraphicsprogramming commented 5 years ago

I think you're missing a drop-down list for the BRDF models, which are outlined in the PDF spec of the BRDF Explorer (I think there are about 5 or so).

Change roughness/metallic/refraction spinners into sliders

I personally think that sliders would be good for colors as well ( in addition to color picker), but if that is impossible for some reason, let me know.

image I would make it so that when the image slot preview (in the resource dock window) is clicked on, the file dialog is opened instead of the current set-up.

Remember that the BRDF explorer states the following:

Give the User a choice whether values should come from textures or be ”constants” tweakable with GUI sliders

(can use a dropdown list with 5 options, "Constant", "Texture 0", "Texture 1", ...) (you can show the texture preview when its a texture, and 4 sliders when its a constant)

Textures are bound to channels, channels can be bound to shader parameter inputs. No textures directly to inputs, shader input can only choose texture channel.

image Light position can stay as a spinner.

The roughness value will need two sliders, and its a bit complicated:

a ”lock” checkbox that makes two roughness sliders locked together so both produce the same value (grey it out when isotropic [note: only anisotropic BRDF is Ashkimin Shirley] BRDFs are used).

The bumpmap height/scale parameter is the only one that does not have a 0-1 range, it needs a bit extra range (like 1-20 or something like that).

P.S. I know I'm being picky, so forgive me for this comment image I think the texture buttons should be arranged into a 2x2 quad like in Shader Maker

manhnt9 commented 5 years ago

The CEGUI GameGUI demo uses something else (it's own theme), we can try that. CEGUI uses FreeType for font rendering. And this is TaharezLook.

devshgraphicsprogramming commented 5 years ago

Looks like a perfectly acceptable skin for the final product.

manhnt9 commented 5 years ago

You mean TaharezLook or GameMenu theme?

devshgraphicsprogramming commented 5 years ago

@manhnt9 asked for a list of BRDF/BSDFs (I presume for the drop-down lists).

Specular:

Diffuse:

Note: Who's to implement those is yet to be decided (its a separate issue on its own).

manhnt9 commented 5 years ago

Should it be check boxes instead? So viewer can see combined models, maybe?

devshgraphicsprogramming commented 5 years ago

No, you pick one BRDF for diffuse and another for specular, there are no other combinations that make sense.

manhnt9 commented 5 years ago

OK, so there'll be 2 dropdown lists. I was thinking about the break-down of the components for a fixed BRDF algorithm. So we'll have multiple ways of calculate the effects and visualize the final BRDR render, so the dropdown is like graphics setting. Interesting! I should learn these.

devshgraphicsprogramming commented 5 years ago

Diffuse and Specular are orthogonal to each other, one is short range scattering the other is reflection.

manhnt9 commented 5 years ago

I've found papers of Lambert, Oren-Nayar, GGX, Ashikhmin-Shirley. Where do I learn about these below?

devshgraphicsprogramming commented 5 years ago

GGX Metallic workflow: https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf

The Dielectrics I'll do myself.

manhnt9 commented 5 years ago

Update about theme choice:

ghost commented 5 years ago

Current progress. The color picker is now available, along with a complete layout overhaul.

The currently used theme is a variant of AlfiskoSkin with custom modifications & additional widgets ported from the vanilla CEGUI skin. I tried sticking to imgui's default color scheme

For reference, here's the original AlfiskoSkin:

Checking the checkbox (heh!) will now lock one slider & enforce two sliders to be equal:

A drop-down list is now available and will disable GUI sliders if "Constant" is selected:

Crisspl commented 5 years ago

I've found papers of Lambert, Oren-Nayar, GGX, Ashikhmin-Shirley.

@manhnt9 Can you post the links here?

manhnt9 commented 5 years ago

@Crisspl I downloaded and didn't save the links. Give me your email address, I will send.

Crisspl commented 5 years ago

Send to the one assigned to my GitHub account (viewable in profile page), thanks :)

devshgraphicsprogramming commented 5 years ago

@manhnt9 Can you post the links here?

Guys I made the bibliography in the Overleaf PDF for a reason, you can retrieve most references as links anyway.

devshgraphicsprogramming commented 5 years ago

@Florastamine can you give me the GUI prototype to play with?

Beautiful work.

I don't currently understand how you've done the whole "source" drop down.

devshgraphicsprogramming commented 5 years ago

@Florastamine its the "Roughness" that can be anisotropic, not the Refraction Index

manhnt9 commented 5 years ago

I think @Florastamine can send a binary version for Matt to play with it. It's time to tune to GUI features. Visual is good now I think. Do you prefer Windows or Linux version?

devshgraphicsprogramming commented 5 years ago

Whatever is easiest for you.

ghost commented 5 years ago

@devshgraphicsprogramming Yes, I have just corrected that now. Sending binaries your way

devshgraphicsprogramming commented 5 years ago

Light position can stay as a spinner.

Should be a numerical value per each XYZ coordinate that can be typed

manhnt9 commented 5 years ago

@devshgraphicsprogramming Could you make an issue specifying what do you need for CEGUI sRGB texture and color picker?

devshgraphicsprogramming commented 5 years ago

open one and write down your questions, also give me links to CEGUI source files as reference ;)

ghost commented 5 years ago

I have updated the GUI to reflect necessary changes, please download included binaries (Windows-only) & test them well.

BRDFExplorerGUI.zip

devshgraphicsprogramming commented 5 years ago

I'm missing libgcc.dll and libfreetype.dll etc., could you possibly make a statically linked build?

ghost commented 5 years ago

I hope I've got all possible dependencies sorted out... it's so monstrosity that making a statically build is a huge feat.

BRDFExplorerGUI.zip

It's bloated, but should run on anything. Just Windows things, I guess.

manhnt9 commented 5 years ago

I'm missing: libCEGUIExpatParser.dll

ghost commented 5 years ago

Updated.

manhnt9 commented 5 years ago

Nice, it even runs on Linux with Wine.

Screenshot_2019-04-20_18-04-54

ghost commented 5 years ago

A bug which made certain UI elements impossible to click through has been fixed, new files were issued.

devshgraphicsprogramming commented 5 years ago

A bug which made certain UI elements impossible to click through has been fixed, new files were issued. Please download it here.

I think at this point a public git repo is in order ;)

manhnt9 commented 5 years ago

We will publish the source and merge into irrbaw when the GUI part is marked as done. Then we concentrate on the BRDF part and GUI should be touched as little as possible. It helps us to assure the overall integrity.

devshgraphicsprogramming commented 5 years ago

btw @Florastamine I can no longer download the zip

ghost commented 5 years ago

@devshgraphicsprogramming I've updated the expiration date to a maximum of 1 week. Please try to download the file again.

BRDFExplorerGUI.zip

devshgraphicsprogramming commented 5 years ago

I still get a 404

ghost commented 5 years ago

BRDFExplorerGUI.zip

devshgraphicsprogramming commented 5 years ago

Ok my comments from testing:

If you address the above then I believe we're done on the GUI design front.

ghost commented 5 years ago

The example app doesn't like my dual monitor set-up, everything is scaled down badly and not very legible (usually not a problem, as integration will be into irrBAW)

It'd be nice if you could provide a screenshot & your resolution. I personally don't have a lot of resources to test against every single resolution & monitor setup, but I'll see what I can do. Could also be the GUI that is faulty.

not all GUI gets hidden by F1

Do you mean this particular sliders window? It's something I put in just for the demo to easily set background colors, i. e. for testing purposes. image

The rest should be trivial to fix.

ghost commented 5 years ago

A new build is now live. image

Apart from the fixes, the text fields in both AO & bump-mapping window now accept manual input & would pop out an error message if the file couldn't be found. image

The texture preview window was also improved to display its child textures' name. image

There are two known issues remain, both of which is CEGUI's: Crash on double-clicking the ColourPicker's titlebar, CEGUI::ColourPickerControls doesn't respect CEGUI::ColourPicker::setVisible().

BRDFExplorerGUI.zip

devshgraphicsprogramming commented 5 years ago

lovely

devshgraphicsprogramming commented 5 years ago

Minimal issues:

P.S. It's sad that the rounded corners have had to be sacrificed, but those buttons could be made a bit smaller (now they feel feally big compared to everything else.

ghost commented 5 years ago

New build here: BRDFExplorerGUI.zip

The FPS is rather low (only 30 FPS)

Weird. I got 60 with V-Sync and 5,000 uncapped.

The background behind sliders (the slider gradient has issues updating)

There's nothing I could do about that I'm afraid. For reference, the original Alfisko also exhibits the same inconsistent behavior when it comes to updating the sliders: image

It pretty much happens at random and the only way to get the sliders updated correctly is to drag another slider, but then the dragged one is also affected. I really have no clue if it's CEGUI being iffy or the theme itself. Might as well investigate later.

The file dialog issue has been fixed. Additionally, tooltips have been implemented for certain widgets (the texture buttons, for example, which can show additional information, i. e. size, date/time, etc. when hovering on them): image

manhnt9 commented 5 years ago

I have 50-60 FPS and 5000 max on Linux with Wine.

devshgraphicsprogramming commented 5 years ago

There's nothing I could do about that I'm afraid. For reference, the original Alfisko also exhibits the same inconsistent behavior when it comes to updating the sliders: image It pretty much happens at random and the only way to get the sliders updated correctly is to drag another slider, but then the dragged one is also affected. I really have no clue if it's CEGUI being iffy or the theme itself.

File an issue.

ok, we're done here then, lets dump the source to this somewhere and begin making example 13.BRDFExplorer

manhnt9 commented 5 years ago

Okay, I'll do a quick source code review and integrate into the example in this repo.

ghost commented 5 years ago

Three known (non-blocking) bugs remaining:

Although given the authors' stance on various unsolved issues over the years (lack of manpower and such), we'd most likely have to fix them ourshelves somewhere down the line.

manhnt9 commented 5 years ago

Yes, my plans also include CEGUI development so there'll be at least 1 person who helps fighting CEGUI issues in near future.