OpenB3D Questions

Started by Krischan, January 04, 2019, 23:33:07

Previous topic - Next topic

Krischan

#15
Thanks Mark - I'll give it a try this evening. Looks like OpenB3D gets better every day :-) The MSI Afterburner is a free tool for overclocking but has the nice feature of this overlay for DX/OGL, too. You can display a lot of data like FPS, CPU/GPU usage, Core temp/clock and so on which is very useful for developing. You can download it here:

http://download.msi.com/uti_exe//vga/MSIAfterburnerSetup.zip

Here is a short video how to set it up:
https://www.youtube.com/watch?v=uIlMRRlKQGg

For the letter bug in LOF, do you have a screenshot? I haven't noticed this. There is a hidden debug mode for the menu screen - press the ^ circumflex key to see the menu text layout borders and change the resolution with 1,2,3 or 4 to see if it works (see attachment).
Kind regards
Krischan

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

Krischan

#16
I've tested the current version, the OSD works fine now, but it is still crashing here at Renderworld when loading a new level. Again, commenting the two ShadeSurface commands in the ApplyShaderCache Method "fix" the crash. I've used the LOFDEV_2019_01_07.zip with the LOF_DevPatch001.zip applied to make sure we have the same version for testing.
Kind regards
Krischan

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

markcwm

#17
Bummer. Okay since i can't reproduce try this please. Goto openb3dlib.mod/openb3d/src/material.cpp line 458
if (brush->tex[ix]==0 && surf->brush->tex[ix]==0 && Shader_Tex[ix]==0) return; // fixes crash if no textures
and comment that and replace with just "return;" and rebuild (without -a for quick build). Then uncomment your ShadeSurface and test, it shouldn't crash then.

If that works then try debugging so go to the top of material.cpp and add #include <stdio.h> then before the same return add printf("%p %p %p \n",brush->tex[ix],surf->brush->tex[ix],Shader_Tex[ix]); and replace the return with the commented line above, build that and run until it crashes, then post the bottom 30 lines of the output window, hopefully there will be some (Nil) pointers. Thanks.

Krischan

Mark, I hope I followed your instructions correctly (it's early in the morning here ;D ). Commenting line 458 leads to the same result like commenting the two shadesurface commands - the models stay while all other textures vanish. Reloading is possible then.

Sometimes it loads the first level, sometimes it crashes without a warning, perhaps because there is too much output to the console window (the whole system hangs then for a while).

I've added some Screenshots including the complete log of a successful debug run trying to load the next level. I hope you can see the problem, I see only a bunch of digits ???
Kind regards
Krischan

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

markcwm

#19
Hi Krischan,

thanks for the output window text, I've a new fix up for this ShadeSurface no tex bug. Your debug shows first if there's a shadertex, then brushtex, then surfacetex, it suggests you're not applying a ShaderTexture at all, so that may be a bug in your BSP code but it still shouldn't crash. I didn't notice until now but TurnOn was changed in Openb3d 1.25 and a small mistake made which should now be 100% fixed, but if it still crashes goto material.cpp line 459 and edit it to be just: if(Shader_Tex[ix]==0) break;

here's a screenie of the text bug, it appears after reloading a level but not at first load, it seems to keep to the same letter all the time but the color of the block often changes to black/purple or white.



Krischan

Mark, I hate to say it but it still crashes here - there must be another problem. The question is why the April 30 version works. On the other hand, I've never seen the bug in your screenshot and I can't explain what could be wrong there. So why is only the "T" missing here? This makes no sense. It's a simple TTF font converted to OTF and using LoadImageFont, nothing special.
Kind regards
Krischan

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

markcwm

Hi Krischan,

okay, I just noticed a bug in Surface constructor where vbo_id[] is set out of bounds, that may be crashing things for you. I also added new code to shader TurnOn which should be correct in theory and works here.

The text bug happens with other letters too, it just seems to be random, it may be something wierd in my Blitzmax install, I'll rebuild modules and see if it goes away.

Krischan

Crash ;D Is there any way that I can help you debugging this? All other OpenGL games work perfect, even the very old RTCW or ET. Do you test on nVidia or Ati? And you're using my Blitzmax setup?
Kind regards
Krischan

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

markcwm

Hi Krischan,

yes that's disappointing! Well simplifying problems is always best, so can you confirm this crash is with the latest commit which is now fix 5 for this issue. To help you could run all shader examples in openb3dmax.docs to see if any crash, also you could test the texture loader in standard/lightmap, etc. Then you could go to material.cpp and at line 458 add a newline and paste:
if(Shader_Tex[ix]==0) break;
What happened was Angros added code for brush and surface.brush properties to Shader::TurnOn which is still there but I've tried to make it safe. I don't really understand why he did this as a normal texture shouldn't really be used as a shader texture if not specified. The next step is to just revert to the old version.

Krischan

#24
Hi Mark,

yes, I always use the latest commit. I've run all shader samples now in Debug mode, they work perfect except this one:

pixellight2.bmx crashes in line 54 (BrushFX) and according to debuglog in the function Shadesurface. Uncommenting Line 53-55 shows the tree, pressing P two times = crash. Hmm, sounds common? ;-)

The textureloader seems to work. Adding the line to material.cpp has no effect at all.
Kind regards
Krischan

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

markcwm

Hi Krischan,

Hah, yes too common really! :P Well in this case the example is just referencing the wrong surface, so that's fixed now.

Thanks for testing, strange that the edit to material.cpp doesn't work when a return in the same place did, I have reverted Shader::TurnOn to the earlier (Apr 30) version, I also fixed a bug in LoadTexture, ApplyAlpha was accessing pixels outside bounds. There was also some bones code commented out in TB3D and I never noticed, animations I tested worked though.

I added a new CollapseAnimMesh for LoadMesh because it seemed to not be working properly, at least on 3ds files, the new function is working much better. It also transforms mesh vertices in case they have entity positions. T3DS has had it's multi-surface code removed now that CollapseAnimMesh works.

Krischan

#26
There is an error compiling the current version in TSurface.bmx;151;3. Unable to convert from 'Byte Ptr' to 'String'

As it is only a debug function and I didn't know how to fix it I've REMarked the whole function to test the reverted shader functions - and guess what? It WORKS reloading the level, including the models and MSI Afterburner. Great. :o And the pixellight2.bmx example works too.
Kind regards
Krischan

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

markcwm

#27
Hi Krischan,

well that's a relief as I was beginning to wonder if I was ever going to fix that! :o

The string error is a BRL Bmax issue where you have to cast byte ptr to int, NG Bmax doesn't need that, I think it might auto-cast pointers. I added a StringPtr function for the fix.

Well I've a new commit fixing a few more things, first the previous ApplyAlpha fix was bad, it was a for..until loop and I thought it was a for..to loop so I added -1 which left alpha textures with 2 black edges.

Then I added alpha to LightMesh, it takes the value from EntityAlpha or BrushAlpha.

The other fix is for vertex colors and normals render states, I've let the library completely manage vertex colors, this was the only way I could find to fix your Starfield demo where it lost vertex colors after loading and also the samples/fakelight example. So there should be no need for SetBlend ALPHABLEND at init now.

For normals, I disabled them in the library and manage them from Bmax in BeginMax2d, the problem was that the metal torches with reflection maps in Romanbath.b3d were blank if managed by the library.

markcwm

#28
Hi Krischan,

I've another small update, but nothing for the CopyEntity issue as I don't understand the problem yet.

CameraViewport is like in Minib3d now, I'm not sure if this fixes your problem as it seems to work the same for me. CameraPick and BackBufferToTex were also changed, all in the library instead of the wrapper.

DebugObject for Texture and Brush were added.

A fix for tex.gltex which wasn't working for normal single-frame textures.

A slight change to Graphics3D, GraphicsInit is now after the library function, as it should store the render states but it didn't seem to make any difference.

Krischan

There is still no crash, but a new bug in LOF: switching the resolution with keys 1-4 creates a "black bar" on the screen and the camera positioning goes wrong. This worked before.

Engine workflow: Key Press > call SetResolution(x,y) in main file > function SetResolution in include/system.bmx > calls SetGadgetShape, CameraViewport, CameraZoom

Kind regards
Krischan

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