Ooops
July 09, 2020, 09:55:47 AM

Author Topic: Some minor issues with current OpenB3D commit  (Read 291 times)

Offline Krischan

  • Full Member
  • ***
  • Posts: 216
    • Krischan's Homepage
Some minor issues with current OpenB3D commit
« on: June 25, 2020, 09:54:49 AM »
Hi there,

beside many other and perhaps more important problems the world currently faces in real life, I just want to mention that I'm still there and traditionally have some minor issues with the current version (June 23, 2020 commit), before that I've been working with the Dec 7, 2019 commit. Mark, perhaps you can investigate these issues when you find some time.

1) Shadows are not working in a MaxGUI window, using only the Graphics3D command they work (all commits)

2) running the following code only works in Debug mode only, in Release mode I only get a black screen (it works with the Dec 7 commit)

Code: BlitzMax
  1. SuperStrict
  2.  
  3. Framework Openb3dmax.B3dglgraphics
  4. Import maxgui.Drivers
  5.  
  6. Local SCREEN_WIDTH:Int = 1920
  7. Local SCREEN_HEIGHT:Int = 1080
  8.  
  9. ' shadows not working / crash with shaders
  10. Local MAXGUI_WINDOW:TGadget = CreateWindow("Test", ClientWidth(Desktop()) / 2 - ((SCREEN_WIDTH) / 2), ClientHeight(Desktop()) / 2 - ((SCREEN_HEIGHT) / 2), (SCREEN_WIDTH), SCREEN_HEIGHT, Null, WINDOW_TITLEBAR)
  11. Local MAXGUI_CANVAS:TGadget = CreateCanvas(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MAXGUI_WINDOW, 0)
  12. SetGadgetLayout(MAXGUI_CANVAS, 1, 1, 1, 1)
  13. ActivateGadget(MAXGUI_CANVAS)
  14. SetGraphics CanvasGraphics(MAXGUI_CANVAS)
  15. Graphics3D(SCREEN_WIDTH, SCREEN_HEIGHT, 0, 2, 60, -1, True)
  16. EnablePolledInput()
  17.  
  18. ' working
  19. Graphics3D DesktopWidth(), DesktopHeight(), 0, 2
  20.  
  21. Local camera:TCamera=CreateCamera()
  22. PositionEntity camera,0,0,-15
  23.  
  24. Local light_piv:TPivot=CreatePivot()
  25. Local light:TLight=CreateLight(2,light_piv)
  26. PositionEntity light,25,10,25
  27.  
  28. Local plane:TMesh=CreateCube()
  29. ScaleEntity plane,25,0.1,25
  30. MoveEntity plane, 0, -2, 0
  31.  
  32. Local cube:TMesh = CreateCube()
  33. Local cube_shadow:TShadowObject=CreateShadow(cube)
  34.  
  35. Local alpha_piv:TPivot = CreatePivot()
  36.  
  37. Local cube2:TMesh = CreateCube(alpha_piv)
  38. PositionEntity cube2, -5, -1, -5
  39. Local cube_shadow2:TShadowObject = CreateShadow(cube2)
  40.  
  41. While Not KeyDown(KEY_ESCAPE)
  42.  
  43.         ' render
  44.         CameraClsMode camera, 1, 1
  45.         RenderWorld
  46.  
  47.         ' 2D output
  48.         BeginMax2D()
  49.        
  50.                 DrawText("Max2D Test", 0, 0)
  51.        
  52.         EndMax2D()
  53.        
  54.         TurnEntity cube, 0.1, 0.2, 0.3
  55.        
  56.         Flip True
  57.        
  58. Wend
  59.  
  60. End

3) I'm not sure but I think I can only run GLSL 130 examples, what about "newer" Shaders like 330 or 450? is it possible or does this require a complete overhaul for the shader code? The problem is that I can't run many examples I've found in the internet and 130 is *very* outdated

4) I'd like to see how to implement shadows using a shader only, but I don't know how to do this with OpenB3D

5) a working example of Parallax Occlusion mapping in a shader with OpenB3D would be nice, too

I've added my current OpenB3D/Blitzmax PBR shader sandbox demo as an attachment - with the problems above mentioned but compiled with the Dec 7 commit to see it in action. In the "_PBR" texture, the Ambient Occlusion/Roughness/Metallic textures are compiled in the R/G/B channels.
Kind regards
Krischan

Windows 10 Pro | i7 9700K@ 3.6GHz | RTX 2080 8GB]
My Blitzbasic Archive | Extrasolar Project | My Github projects

Offline Kippykip

  • Full Member
  • ***
  • Posts: 118
    • Kippykip Forums!
Re: Some minor issues with current OpenB3D commit
« Reply #1 on: June 26, 2020, 10:33:56 AM »
Hmm, it wouldn't have anything to do with this recent change would it?
https://github.com/markcwm/openb3dmax.mod/commit/6e3e4d69da7cc0529bec55e225b02a8605b2cf94

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 465
Re: Some minor issues with current OpenB3D commit
« Reply #2 on: June 26, 2020, 04:11:05 PM »
1) is from a hack on Mar 26 Fix for cubemap black line where you have to change the graphics height in win32 by deducting the titlebar height to fix BackBufferToTex. It's a hack because it should be deducting the actual height of the titlebar instead of getting GraphicsHeight, and I didn't think of smaller windowed mode at the time.

2) still hunting the black screen but found if you add UpdateCanvas(can,cam) at the start of the loop it fixes it.

Offline Krischan

  • Full Member
  • ***
  • Posts: 216
    • Krischan's Homepage
Re: Some minor issues with current OpenB3D commit
« Reply #3 on: June 26, 2020, 10:36:07 PM »
Thanks for the response, so I should wait for the next commit?

I forgot to mention a more serious issue. In the PBR demo I'm unable to use the CreateShadow() function - the demo always runs in an exception then (and beside that, it doesn't work). I could connect the problem to the GL lights in the InitLights() function but I don't understand the problem. I just want that the GL lights create shadows on the level geometry while keeping the PBR shading.

I modified the demo code a little bit, see attachment. Just walk towards the skull for a crash or walk around to see strange shadow artefacts.
Kind regards
Krischan

Windows 10 Pro | i7 9700K@ 3.6GHz | RTX 2080 8GB]
My Blitzbasic Archive | Extrasolar Project | My Github projects

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 465
Re: Some minor issues with current OpenB3D commit
« Reply #4 on: June 29, 2020, 08:45:32 PM »
Hi Krischan, I'm snowed under by real life concerns so I will be unable to help any more. Very sorry.

Offline markcwm

  • Sr. Member
  • ****
  • Posts: 465
Re: Some minor issues with current OpenB3D commit
« Reply #5 on: July 04, 2020, 03:18:25 AM »
Well I found some time today, so here's an update July 4. Happy American independence day!

It's only a fix for 2) Maxgui has black screen in release mode.
Although I got a black screen in debug mode too (so maybe not the right fix, needs a test). It was when I made a fix for texture rendering in fullsize windowed mode where GlobalHeight was not what you expect, anyway in Maxgui GraphicsHeight returns zero and that caused the black screen.

It's also an update to Audio3d, to make it like Blitz3d syntax so now you don't have to import the audio modules and can use CreateListener (Init3DSound) and EmitSound (Start3DSound).

The reason 1) doesn't have shadows in Maxgui is because you have to init the buffers, so that's not a bug:
Code: [Select]
Local flags%=GRAPHICS_BACKBUFFER|GRAPHICS_ALPHABUFFER|GRAPHICS_DEPTHBUFFER|GRAPHICS_STENCILBUFFER|GRAPHICS_ACCUMBUFFER
SetGraphicsDriver GLMax2DDriver(),flags ' before SetGraphics

Offline Krischan

  • Full Member
  • ***
  • Posts: 216
    • Krischan's Homepage
Re: Some minor issues with current OpenB3D commit
« Reply #6 on: July 06, 2020, 01:48:04 PM »
It's a pity to hear that Real Life involves you as much as it does me - I'd like to code a lot more but somehow I have less and less time.

With your fix the shadows now work in MaxGUI but I still get fatal exceptions when I use a shader and move around, so I won't use shadows anymore as i don't know how to debug this. Instead I continued to work on my shader and for better visualization I've created a cave with really good textures and the PBR shader now looks very nice even without shadows.
Kind regards
Krischan

Windows 10 Pro | i7 9700K@ 3.6GHz | RTX 2080 8GB]
My Blitzbasic Archive | Extrasolar Project | My Github projects

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal