Author Topic: Viewport in Particle Editor broken after changing texture  (Read 157 times)

0 Members and 1 Guest are viewing this topic.

caedes

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +19/-11
  • Demon Herder
    • View Profile
    • My Github Account
Viewport in Particle Editor broken after changing texture
« on: March 02, 2019, 11:06:40 PM »
I'm working on bringing the Windows-only MFC tools to dhewm3 (see https://github.com/DanielGibson/dhewm3/tree/tools if you're interested) - it's based on the older dhewm3-based SteelStorm2 code, so thanks to motorsep for giving me that code! :)

Seems to work overall, however there is an issue with the Particle Editor that also exists with the original 1.3.1 binaries (at least on my System: Win10, Intel Haswell CPU with Iris Pro GPU):
When selecting a different  texture (and clicking "Ok" or whatever you click to close the texture selection window), a new small viewport turns up in the lower left corner of the window and is used exclusively (the rest of the window doesn't seem to really get updated anymore), looks like this:

Has anyone encountered this before? Were you able to implement a fix or at least workaround?
« Last Edit: March 03, 2019, 01:19:16 PM by caedes »

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 949
  • Karma: +45/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: Viewport in Particle Editor broken after changing texture
« Reply #1 on: March 03, 2019, 11:38:31 AM »
I don't remember a workaround when that would happen to me.  Maybe I didn't care, maybe I had a key bound to "reloadengine" and that fixed it.  :)  It didn't happen often though, only very rarerly.

caedes

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +19/-11
  • Demon Herder
    • View Profile
    • My Github Account
Re: Viewport in Particle Editor broken after changing texture
« Reply #2 on: March 03, 2019, 02:59:44 PM »
Happens for me every time, I just:
1. start the testmaps/test_box map
2. start the particle editor (editParticles)
3. click the material selection ([...]) button
4. select a different texture
5. click ok (or whatever it's called, I forgot)
6. it looks like on the screenshot I posted

In Doom3 a workaround seems to be to switch to a non-Doom3 window and back to Doom3, for dhewm3 that doesn't work (vid_restart does though).
My first guess is that somehow the wrong GL context is selected after closing the material selection window..

I'm still hoping someone already fixed that in their own port of the engine so I don't have to get familiar with MFC and the editor code and figure it out myself - that code is not really pretty on first sight...

motorsep

  • Hero Member
  • *****
  • Posts: 1,052
  • Karma: +74/-131
  • Artist
    • View Profile
    • Kot in Action Creative Artel
Re: Viewport in Particle Editor broken after changing texture
« Reply #3 on: March 03, 2019, 09:00:47 PM »
I don't remember having this bug at all (not in BFG tools at least) :/

caedes

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +19/-11
  • Demon Herder
    • View Profile
    • My Github Account
Re: Viewport in Particle Editor broken after changing texture
« Reply #4 on: March 03, 2019, 09:30:29 PM »
Maybe it only happens (or happens more often) on Win10 or Intel drivers or something else that differs between our systems (FWIW, Revility originally told me about the problem, so at least it doesn't only happen on my machine).

I guess if this problem had always existed (like it does for me even with original Doom3 binaries) I would have been able to find more information about it and people here would have been more familiar with it, so it might indeed be due to some changed behavior in Windows or drivers

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 949
  • Karma: +45/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: Viewport in Particle Editor broken after changing texture
« Reply #5 on: March 05, 2019, 01:33:06 PM »
ok, happened to me in stock D3 binaries.  It could very well be that I normally have multiple windows open so alt-tabbing is so normal I never noticed.

caedes

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +19/-11
  • Demon Herder
    • View Profile
    • My Github Account
Re: Viewport in Particle Editor broken after changing texture
« Reply #6 on: March 09, 2019, 11:31:28 PM »
Ok, I figured it out, see https://github.com/DanielGibson/dhewm3/commit/5c1e1d770883996eb5bb6a73118bd6d41295d282

The problem was that the widget used to render the preview of the texture in the material picker calls renderSystem->BeginFrame(w, h), with w and h being the size of that preview area.
BeginFrame() will set glConfig.vidWidth/Height, which are otherwise expected to have the window resolution (and are also used in renderSystem->GetScreenWidth()/Height()).
This is never reset (I would have expected that to happen in EndFrame()), so from then on the main (ingame) window will render at that resolution, looking like on the screenshot above.
(I now just restore glConfig.vid* after rendering that preview area.)

motorsep

  • Hero Member
  • *****
  • Posts: 1,052
  • Karma: +74/-131
  • Artist
    • View Profile
    • Kot in Action Creative Artel
Re: Viewport in Particle Editor broken after changing texture
« Reply #7 on: March 10, 2019, 11:26:24 AM »
Ok, I figured it out, see https://github.com/DanielGibson/dhewm3/commit/5c1e1d770883996eb5bb6a73118bd6d41295d282

The problem was that the widget used to render the preview of the texture in the material picker calls renderSystem->BeginFrame(w, h), with w and h being the size of that preview area.
BeginFrame() will set glConfig.vidWidth/Height, which are otherwise expected to have the window resolution (and are also used in renderSystem->GetScreenWidth()/Height()).
This is never reset (I would have expected that to happen in EndFrame()), so from then on the main (ingame) window will render at that resolution, looking like on the screenshot above.
(I now just restore glConfig.vid* after rendering that preview area.)

Cool! I feel like the tools were slapped together by ID just to get things going and never actually polished :(

motorsep

  • Hero Member
  • *****
  • Posts: 1,052
  • Karma: +74/-131
  • Artist
    • View Profile
    • Kot in Action Creative Artel
Re: Viewport in Particle Editor broken after changing texture
« Reply #8 on: March 10, 2019, 11:28:46 AM »
@caedes: Btw, I think it would be better to grab Storm Engine 2 tools (MFC related stuff at least) since, for example, GUI Editor was upgraded and fixed there, but not in dhewm3 fork. This way you have better base to work with that has a lot of bugs already fixed.

The Happy Friar

  • Happy Happy Joy Joy
  • Administrator
  • Hero Member
  • *****
  • Posts: 949
  • Karma: +45/-4
  • Semi-Newbie.
    • View Profile
    • EarthQuake
Re: Viewport in Particle Editor broken after changing texture
« Reply #9 on: March 10, 2019, 01:02:51 PM »
Cool! I feel like the tools were slapped together by ID just to get things going and never actually polished :(
Except for D3 Edit, didn't they admit that years ago by saying they didn't really use the tools, they use notepad instead?  Tools were more dev's for Raven's Q4?

motorsep

  • Hero Member
  • *****
  • Posts: 1,052
  • Karma: +74/-131
  • Artist
    • View Profile
    • Kot in Action Creative Artel
Re: Viewport in Particle Editor broken after changing texture
« Reply #10 on: March 10, 2019, 03:15:59 PM »
Except for D3 Edit, didn't they admit that years ago by saying they didn't really use the tools, they use notepad instead?  Tools were more dev's for Raven's Q4?

Oh, ouch :/

caedes

  • Jr. Member
  • **
  • Posts: 64
  • Karma: +19/-11
  • Demon Herder
    • View Profile
    • My Github Account
Re: Viewport in Particle Editor broken after changing texture
« Reply #11 on: March 10, 2019, 11:00:02 PM »
@motorsep: I might look at that code (and maybe merge it) later, right now I'm glad I have working tools at all :)
Do your tools work in 64bit builds? Do you know if any changes were necessary for that?
I declared mine 32bit-only for now because I don't really trust that code and I don't have time to extensively test them to find out if things break in 64bit..

BTW, this is now officially in dhewm3 and I just did a pre-release (incl. Win32 binaries) containing it:
https://dhewm3.org/#a-first-prerelease-of-dhewm3-1.5.1

motorsep

  • Hero Member
  • *****
  • Posts: 1,052
  • Karma: +74/-131
  • Artist
    • View Profile
    • Kot in Action Creative Artel
Re: Viewport in Particle Editor broken after changing texture
« Reply #12 on: March 11, 2019, 12:43:15 AM »
@motorsep: I might look at that code (and maybe merge it) later, right now I'm glad I have working tools at all :)
Do your tools work in 64bit builds? Do you know if any changes were necessary for that?
I declared mine 32bit-only for now because I don't really trust that code and I don't have time to extensively test them to find out if things break in 64bit..

Yeah, 32bit and 64bit both work (Storm Engine 2 based off BFG). Also I just remembered we did some fixes for inlined meshes in dmap (Storm Engine 2 based off BFG). What was done for 64bit to work, I have no clue, sorry :(

BTW, this is now officially in dhewm3 and I just did a pre-release (incl. Win32 binaries) containing it:
https://dhewm3.org/#a-first-prerelease-of-dhewm3-1.5.1

\o/ yay, congrats! Now you just need to find people to use them and test them :)