MiniB3D v0.41
BlitzMax Forums/MiniB3D Module/MiniB3D v0.41
| ||
A small update, just fixes various bugs found in V0.40, and adds a couple of things, including the AntiAlias command. MiniB3D is also now distributed as an import file and a module. Download from www.si-design.co.uk |
| ||
you...are...da...man! edit. got a chance to look. everything runs smooth so far. |
| ||
Funtastic! Although the new AA command is pretty much useless in action (fps drops from 60 to1, independently from the setting 1-16) but for frame capturing it's really great. Btw, I checked the blob example again, it doesn't work any better unfortunately. Didn't you want to have a look as why the blobs are added too close to one another? Don't know if this an important bug or no bug at all, but at least it's not the same behavior as in B3D. |
| ||
all looks good, had to rename MiniB3D.bmx to minib3d.bmx before the module would build tho... |
| ||
The AA is useless on older Gfx cards due the fact it uses the Accumulation buffer and this buffer is only emulated (as far as I know first ATI card was the Radeon 9800) on older gfx cards. So you have to live without AA for the moment ;). |
| ||
I had no idea the AA required a hardware accelerated accumulation buffer! Probably not in keeping with MiniB3d's 'low-spec' philosophy to be honest, but ah well, it's there if you need it. Barbapapa - the ScaleEntity issue has definitely been fixed. Any difference between the .bb and .bmx versions of the blobs demo now is solely due to TurnEntity behaviour. ChrisC - thanks for letting me know, I've repackaged it now with lowercase minib3d. |
| ||
oh no, it's there it's great, so I can do a AA16 before I do a screenshot, even save every frame out with full AA for a movie. You see, architects here seldom have new hardware;) @simonh, two questions, how did you do your game? with MiniB3D? because it seems being some AA on it. At least I have much lesser jaggies I have with MiniB3D. I don't understand what TurnEntity has to do with the placing of the blobs? Even when I cancel the spinning of the parent, the blobs are not placed where they should be. Maybe you could have a small look at it ;) Not that I will be doing blobs allot, but I can't understand what's wrong... |
| ||
My game was written in Blitz3D - I'm in the process of converting it to MiniB3D. There isn't any AA going on - just some nice alpha blended edges. Here's a straight BMax conversion of blobs.bb which, as far as I can tell, works fine: |
| ||
There isn't any AA going on - just some nice alpha blended edges ?? could you explain this a little further? even all moving objects seem smooth, how can you add edge alpha-blendings on non-static meshes? I tried your source, I think what caused the grief was that I either had the parent spinning (and had the MiniB3D entity behavior) or I had it fixed and then was fooled by the camera. When I prevent spinning on your code I had the same issue (blobs seeming to be to near to one another) but when letting the parent spin again they showed up correctly. Although they seem to be getting smaller. If you stop the spin and then click very fast so that you get a long chain you will see what I mean. Let it spin again and observe the size of the blobs in the long chain. What do you think? I don't have B3D anymore so I can't check anymore (why did I pick this example ;)? ) |
| ||
The sprites have alpha blended edges. The ball has a little motion blur applied, otherwise there are no AA effects. I guess it must just be a trick of the eye, unless your gfx card is forcing AA. As for the blobs, the balls are meant to get smaller. There is a line in the code that scales each ball a little less than it's parent. |
| ||
yes, I guess I didn't do the massive click test with the original, sorry for that. But at least you have another example ;) Will try the alpha blending trick, never came to my mind. I guess I'm too used of high AA settings for my rendering :) |
| ||
Lol .. When it comes to cubemapping, MiniB3D is faster than the old B3D .. Very impressive. Keep rocking simonh..! |
| ||
AntiAlias on ATI works for all Shader2 cards. That said it is the 9500 (or to keep it with the more used numberings 9600). Pre 9500 the 9000 series are nonshader or shader 1.1 / 1.5 compliant cards. Don't ask me why ATI mixed several generations in a single series. (9000 nonshader, most likely been there to take off some of GF4 MXs users *would assume thats a 7000 series GPU*, 9100 is a pushed 8500 so much more powerfull than most other 9000 series cards but shader 1, 9200 is a "true" new chip but no shader 2 support.) As a side note: I'm not sure if this is actually a problem. Most systems today should do that hardware side without much problem. Current gen DX redistributable does not support shader 1 anymore, so at least on the Windows side, its quite clear, that those will die out. (Win98 / ME isn't supported anymore as well since DX Dec 06) On the apple side, there only have been shader based chips for quite some time (OSX 10.3) as their eye candy desktop depends on it. So I would prefer if the AntiAlias would remain in miniB3D. Its a standard feature which any 3D card sold the last 4-5 years supports and if not, the programmer can still add the option for setting AA to 0 or off. |
| ||
All examples crashes on "LoadTexture" call on my laptop (Intel GMA950 crappy graphic card) but everything works fine on Nvidia cards, any idea? |
| ||
@LAB[au]: Try putting this in the entityvisible.bmx example, right after the Graphics3D width,height,depth,mode line.It might be GL_ARB_multitexture is misssing. I'm very interested to know if that's the case, because I'll be meeting those low end GFX cards often. If (GL_VERSION_1_3 | GL_VERSION_1_3 | GL_VERSION_1_4 | GL_VERSION_1_5 | GL_VERSION_2_0) Notify "OpenGL 1.3 or better present" multitexturePresent = True ElseIf (GL_ARB_multitexture) multitexturePresent = True Notify "GL_ARB_multitexture OK" Else Notify "GL_ARB_multitexture MISSING!" EndIf |
| ||
It reports "OpenGL 1.3 or better present". Entityvisible.bmx compiles and runs fine since there is no texturing. The problem is in AdjustPixmap function in TTexture type (TTexture.bmx) and specifically in this loop: ' check that width and height size are valid (not too big) Repeat Local t glTexImage2D GL_PROXY_TEXTURE_2D,0,4,width,height,0,GL_RGBA,GL_UNSIGNED_BYTE,Null glGetTexLevelParameteriv GL_PROXY_TEXTURE_2D,0,GL_TEXTURE_WIDTH,Varptr t If t Exit If width=1 And height=1 RuntimeError "Unable to calculate tex size" If width>1 width:/2 If height>1 height:/2 Forever If I comment this loop everything runs fine. |
| ||
I had this problem too with my old computer. There is a fix somewhere in here. Check the threads about the different releases. 0.3 if i remember correctly. |
| ||
I found only a post about Pow2size but nothing about this check... on this computer this is always true : If width=1 And height=1 RuntimeError "Unable to calculate tex size" |
| ||
Is that the error message you always get, 'unable to calculate tex size'? Do you have any problems with Max2D? |
| ||
The problem is because the AdjustPixmap function is using GL_PROXY_TEXTURE_2D. I don't know why simon has build in this back to 0.41 but try to replace this function with this one:Function AdjustPixmap:TPixmap(pixmap:TPixmap) Local width=Pow2Size(pixmap.width) Local height=Pow2Size(pixmap.height) If width<>pixmap.width Or height<>pixmap.height pixmap=ResizePixmap(pixmap,width,height) EndIf Return pixmap End Function That should hopefully work. |
| ||
GL_PROXY_TEXTURE_2D is used to see if your texture is too big to be loaded. Without it if you try loading a massive texture that's too big for your gfx card, the texture won't be loaded - with it, it will be rescaled to a size that does work. Not sure why it fails on some computers. |
| ||
Shouldn't the above code look more like: http://lists.apple.com/archives/mac-opengl/2004/Oct/msg00148.html where there is a glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &testHeight); call too? |
| ||
isn't the height of a pow2texture the same as the width ;) ? |
| ||
No. Only if it's a square texture. OpenGL alows for rectangular ones like 128 x 512 too. |
| ||
yes sorry, my fault. Maybe this could be a way around the proxy problem:Function AdjustPixmap:TPixmap(pixmap:TPixmap) Local width=Pow2Size(pixmap.width) Local height = Pow2Size(pixmap.height) Local maxsize:Int glGetIntegerv(GL_MAX_TEXTURE_SIZE , Varptr(maxsize) ) If width > maxsize Then width = maxsize If height > maxsize Then height = maxsize If width<>pixmap.width Or height<>pixmap.height pixmap=ResizePixmap(pixmap,width,height) EndIf Return pixmap End Function |
| ||
AFAIK the GL_MAX_TEXTURE_SIZE is not accurate. You have to use the proxy method to get the correct results. GL_MAX_TEXTURE_SIZE gives the theoretical max size for the card, proxy method tells you if the texture will actually fit. |
| ||
To Simonh : Yes I get always this message, 'unable to calculate tex size' and I never had a problem with Max2D. It's not an old computer, I bought it new last year, Intel Gma 950 is pretty common and recent hardware I think (although not the best obviously!). |
| ||
AFIK 'unable to calculate tex size' is a max2d (opengl driver) error message and the reason you've had no problem with Max2d is because the winbloze version of max defaults to directx Max2D |
| ||
Simon, are you going to add LoadAnimSeq, AddAnimSeq commands soon? |
| ||
Yes, I'll hopefully add them soon. |
| ||
@Chris "unable to calculate tex size" is minib3d error message ... in TTexture.bmx ... in Function AdjustPixmap -> runtimeerror. On this GMA950 laptop the variable t is always null while the width and height get lower and lower (reaching eventually 1) while the Repeat forever loop is processed. This function doesn't return anything to t glGetTexLevelParameteriv GL_PROXY_TEXTURE_2D,0,GL_TEXTURE_WIDTH,Varptr t |
| ||
@LAB[au] ask simon.... |
| ||
@klepto2 Thanks anyway, Your replacement for AdjustPixmap function worked. No message 'unable to calculate tex size', any more and at least all mini3d samples are working fine . |
| ||
Klepto2, you replacement corrected the texture issue on my laptop with gma950. thanks |
| ||
Hi, I just noticed that when you set SpriteViewMode to 2 (Free) the sprite cannot be scaled. If you scale the sprite before changing the ViewMode, it resets the scaling to 1. Import sidesign.minib3d' SuperStrict Graphics3D 640,480,0,2 Local cam:TCamera=CreateCamera() cam.PositionEntity 0,0,0 Local light:TLight=CreateLight(1) Local sprite1:TSprite=LoadSprite("clark1.png",3) sprite1.PositionEntity 2,0,7 sprite1.ScaleSprite 4,4 sprite1.SpriteViewMode 2 Local sprite2:TSprite sprite2=LoadSprite("clark1.png") sprite2.PositionEntity -4,0,7 Local n#=1.0 While Not KeyDown(KEY_ESCAPE) n:+0.01 sprite1.ScaleSprite n,n sprite2.ScaleSprite n,n If n>5 Then n=1 RenderWorld Flip Wend End |
| ||
To prevent the "MoveMouse"-Bug on Linux add the following Lines: Look here inc/misc.bmx: Before Function MouseXSpeed() Add: Function MouseXSpeed_LinMM(mmx:int) 'Global oldmx Local mxs=MouseX()-mmx 'oldmx=MouseX() Return mxs End Function Function MouseYSpeed_LinMM(mmy:int) 'Global oldmy Local mys=MouseY()-mmy 'oldmy=MouseY() Return mys End Function inc/func.bmx: Before Function MouseXSpeed() Add Function MouseXSpeed_LinMM(mmx:int) Return TBlitz2D.MouseXSpeed_LinMM(mmx) End Function Function MouseYSpeed_LinMM(mmy:int) Return TBlitz2D.MouseYSpeed_LinMM(mmy) End Function How that works? Just type mx=MouseXSpeed_LinMM(movemousex) my=MouseYSpeed_LinMM(movemousey) movemouse movemousex,movemousey |
| ||
I forgot to post the correction for the SpriteViewMode 2 Scale bug: Just add in Function UpdateSprites, in TGlobal, the Scale command for sprite.view_mode=2: If sprite.view_mode=2 sprite.mat_sp.Overwrite(sprite.mat) scale_x#=sprite.scale_x# scale_y#=sprite.scale_y# sprite.mat_sp.Scale(scale_x#,scale_y#,1.0) EndIf |
| ||
Thanks ksalomao. |