minib3D "small fixes" version up

BlitzMax Forums/MiniB3D Module/minib3D "small fixes" version up

Difference(Posted 2009) [#1]
I've put up a version of minib3d that contains a plain source, with small fixes to let it run under my version of parallels 3.

The tweaks will probably help on older GFX cards too.
any changes to the current minib3d can be found by searching the source for "PSEDIT"

You can get it here

http://code.google.com/p/blitzmax-assimp/source/browse/#svn/trunk/examples/minib3dsf

I'll be happy to but in any (semi sane) fixes/tweaks that anyboby has.


slenkar(Posted 2009) [#2]
out of curiosity, what are the fixes?


Difference(Posted 2009) [#3]
Check it out: http://blitzmax-assimp.googlecode.com/files/minib3d0531-sf01.zip tell me if it runs for you.

any changes to the current minib3d can be found by searching the source for "PSEDIT"


SLotman(Posted 2009) [#4]
Can't you just post what the fixes are(at least what they supposed to fix)? I tried the first link, searched the trunk for PSEDIT, and it found no match on any document.

And if you want more fixes, on my "miniB3D" I implemented the following changes:

- converted miniB3D to SuperStrict
- FreeTexture fix from http://www.blitzbasic.com/Community/posts.php?topic=88263
- CreateSurface & BrushFX/EntityFX fix from http://www.blitzbasic.com/Community/posts.php?topic=88060
- Pivot pick bug fix from http://www.blitzbasic.com/Community/posts.php?topic=78749
- Texture blend compatibility fix from http://www.blitzbasic.com/Community/posts.php?topic=88039
- Texture fix from http://www.blitzmax.com/Community/posts.php?topic=87020
- Collision fix from http://www.blitzmax.com/Community/posts.php?topic=87446
- Collision fix from http://www.blitzbasic.com/Community/posts.php?topic=87551
- Applied small changes from http://www.blitzbasic.com/Community/posts.php?topic=79409


Difference(Posted 2009) [#5]
Thanks SLotman, thats great! I'll try and put those fixes in too and report back.

I'll make a list and post it.


Brucey(Posted 2009) [#6]
converted miniB3D to SuperStrict

Yay ! :-)


Difference(Posted 2009) [#7]
Here a list.
I mailed SLotman asking for his version, as it seems further ahead, If I get it I'll put everything in one version.

I've altered the changetag to "SMALLFIXES" and made a little program to search for them and list them




Difference(Posted 2009) [#8]
Fixlist now part of the repository : http://code.google.com/p/blitzmax-assimp/source/browse/trunk/examples/minib3dsf/smallfixes.txt

I mainly wanted SLotmans for superstrict, but that can come later.
I'm putting in his changes now

I'll put in any sensible small fixes additions that anybody has, so feel free to post them here


Difference(Posted 2009) [#9]
SLotman changes except superstrict and ziggys cleanup is in.


Damien Sturdy(Posted 2009) [#10]
I'm going to move the racer over to MiniB3D I think, since it's extensible, but I could REALLY do with the superstrict version.

how much work was it to do that? (I'm at work so can't look for myself...)
I know it's not hard per say, but time consuming. I can not work without superstrict :-)


SLotman(Posted 2009) [#11]
Not much - took me a couple of hours to do it - it's most just declaring int's since the rest is already declared.


Kryzon(Posted 2010) [#12]
When is SimonH gonna release the next version with these fixes implemented?


*(Posted 2010) [#13]
with warners code for rotation as it seems to fix the problems with eulers.


Tachyon(Posted 2010) [#14]
Yes, SimonH?? When? When!!?!?


Difference(Posted 2010) [#15]
Since I haven't heard from SLotman, I've started adding superstrict.

I'll post back when it's done.


Difference(Posted 2010) [#16]
Superstrict added added to SVN.
I'll make a zip too

[EDIT] : Zip is here: http://code.google.com/p/blitzmax-assimp/downloads/list


I'm planning to change the # float markers to :Float and $ to :String in the forseeable future.


Difference(Posted 2010) [#17]
Added http://blitzmax.com/Community/posts.php?topic=88901#1009408 SLotmans incbin, zipstream fix for textures to SVN.

(Not in downloadable zip yet)

view all changes in http://code.google.com/p/blitzmax-assimp/source/browse/trunk/examples/minib3dsf/smallfixes.txt


simonh(Posted 2010) [#18]
Good work Peter, I'll make sure these fixes get added to the next release from me.


*(Posted 2010) [#19]
When will the incbin fix be in the zip release ??


Difference(Posted 2010) [#20]
Now: .-)

http://code.google.com/p/blitzmax-assimp/downloads/list


*(Posted 2010) [#21]
excellent :D


ima747(Posted 2010) [#22]
I'd just like to thank you Peter for this project. Saves me a lot of time since I bounce from computer to computer a lot, I don't have to remember to bring a copy of my working minib3d with me when I move around (specifically my own texture release patch you integrated is critical for my current project). Great stopgap between official updates from Simon.


Shagwana(Posted 2010) [#23]
I just want to say that this little project is wonderfull, keep up the great work!.


Difference(Posted 2010) [#24]
Thanks all. I'll keep updating, so please feel free to post relevant fixes.

I still think the best solution would be a common repository.. :-)


nrasool(Posted 2010) [#25]
Hi there,

Just out of interest, does this small fix build have the following implemented, if it doesn't, I can add it http://www.blitzbasic.com/codearcs/codearcs.php?code=2498


Difference(Posted 2010) [#26]
It doesn't, I won't put them in, as it would move the module too far away from the "small fixes" concept.

I'd still really like to see them go in to the main branch, but you'll have to poke simonh to make that happen :-)

Did someone report some performance (speed) problems with Warners code or did I dream that?


Kryzon(Posted 2010) [#27]
I haven't tested it myself, but others allege so: http://blitzbasic.com/Community/posts.php?topic=88851#1009397


ima747(Posted 2010) [#28]
It should be heavier (the math is beefier) which in extreme circumstances could result in slower movement etc. Additionally, it's off the main branch so could alter some people's code (stuff that trys to hack workarounds for gimbal lock in their application for example). Additionally I've yet to get it to work right for me, I have lots of parent/child links in my current project and everything just goes whacky and out of control when I try to implement that. Which makes me sad since I could REALLY use better rotations, but I'm just going to wait until simon takes a poke at it, or klepto updates his extended version with it. Would really love to see the main branch, or a spin off use better math, but until it's supported throughout the engine it's a bit more than a "small fix" imo :0)

P.S. small fixes version is still going great for me, thanks yet again for all the work!


JA2(Posted 2010) [#29]
What would it take to add non-boned animation support? The sort of thing you would use to animate a robot or something. I know it's not really a 'small' fix but it does feel like something that's missing from MiniB3D.


ima747(Posted 2010) [#30]
Doesn't it already have keyframe animation support through LoadAnimMesh() and Animate()?


slenkar(Posted 2010) [#31]
you have to put this line in :
If TcollisionPair.ent_lists[type_no]<>Null


to make entitycollided look like this:
		' if self is source entity and type_no is dest entity
		For Local i:Int=1 To CountCollisions()
			If CollisionEntity(i).collision_type=type_no Then Return CollisionEntity(i)
		Next

		' if self is dest entity and type_no is src entity
		If TcollisionPair.ent_lists[type_no]<>Null
		For Local ent:TEntity=EachIn TCollisionPair.ent_lists[type_no]
		
			For Local i:Int=1 To ent.CountCollisions()
				If CollisionEntity(i)=Self Then Return ent		
			Next
		Next
		EndIf
		Return Null



AnniXa(Posted 2010) [#32]
ty for that fixes!


AdamRedwoods(Posted 2011) [#33]
I propose this fix:
Flickering Entities and Alpha Values

explained here:
http://www.blitzbasic.com/Community/posts.php?topic=94108

Please test, to see if it is compatible. I've done my own tests and it seems proper. (tested on an IntelG41)

Last edited 2011


Difference(Posted 2011) [#34]
Thanks guys.


I'll put the above two in soon, so please test AdamRedwoods code proposed fix and report any issues.


ima747(Posted 2011) [#35]
And thank you Difference for maintaining this. Really saves me SO much time not having to track the patches down, or alternatively maintain a pristine copy myself.


AdamRedwoods(Posted 2011) [#36]
Another bug found when passing animated texture frame values to brushes:

http://www.blitzbasic.com/Community/posts.php?topic=94221


Difference(Posted 2011) [#37]
Thanks Adam, I'll put it in.


AdamRedwoods(Posted 2011) [#38]
Found the same above bug with PaintEntity (not passing texture frame)

under TEntity.bmx:
	Method PaintEntity(bru:TBrush)
	
		brush.no_texs=bru.no_texs
		brush.name$=bru.name$
		brush.red#=bru.red#
		brush.green#=bru.green#
		brush.blue#=bru.blue#
		brush.alpha#=bru.alpha#
		brush.shine#=bru.shine#
		brush.blend=bru.blend
		brush.fx=bru.fx
		brush.tex_frame = bru.tex_frame ''copy tex frame over
		For Local i=0 To 7
			brush.tex[i]=bru.tex[i]
		Next
	
	End Method



Difference(Posted 2011) [#39]
Updating now, but

@AdamRedwoods:
regarding Flickering Entities and Alpha Values
What exactly should I put in tmesh?

Yours :
http://blitzmax.com/Community/posts.php?topic=94108#1078568
or
http://blitzmax.com/Community/posts.php?topic=94108#1080776

and exactly what must it replace, this?

' take into account auto fade alpha
	alpha#=alpha#-fade_alpha#

	' if surface contains alpha info, enable blending
	If surf.alpha_enable=True
		glEnable(GL_BLEND)
		glDepthMask(GL_FALSE)
	Else
		glDisable(GL_BLEND)
		glDepthMask(GL_TRUE)
	EndIf



AdamRedwoods(Posted 2011) [#40]
Sent an email. Use my version.

The fix would be to TMesh.bmx
            ' take into account auto fade alpha
            alpha#=alpha#-fade_alpha#

            ' if surface contains alpha info, enable blending
            ' If surf.alpha_enable=True ''this is the old way
            '' ----------- begin new code

            If alpha_order<>0.0
                If brush.alpha#<1.0
                    ''the entire entity
                    glEnable(GL_BLEND)
                    glDepthMask(GL_FALSE)
                ElseIf surf.alpha_enable=True
                    ''just one surface
                    glEnable(GL_BLEND)
                    glDepthMask(GL_FALSE)
                Else
                    ''entity flagged for alpha, but not this surface
                    glDisable(GL_BLEND)
                    glDepthMask(GL_TRUE)
                EndIf
            Else
                glDisable(GL_BLEND)
                glDepthMask(GL_TRUE)
            EndIf

           ''--------------end new code
            ' blend modes
            Select blend
                Case 0
                    glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA) ' alpha
                Case 1
                    glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA) ' alpha
                Case 2
                    glBlendFunc(GL_DST_COLOR,GL_ZERO) ' multiply
                Case 3
                    glBlendFunc(GL_SRC_ALPHA,GL_ONE) ' additive and alpha
            End Select




Difference(Posted 2011) [#41]
Thanks adam, I'll use that. (PS: didn't get your mail )


FBEpyon(Posted 2011) [#42]
Adams doesn't fix the Alpha Z-Ordering, Mine does... and also fixes the flickering, I tested Adams, and it did nothing to mine MiniB3d, so I researched the Z-Ordering in OpenGl and this is what I came up with, trust me try it out with vertex set to alpha.. his with not fix any of the Z-Ordering mine will.. Z-Ordering has to do with the DepthMask, and way his is setup will not fix the Z-Ordering. Try using a mesh with vertex alpha with multiple layers, it should blend perfect, but it could just be his video card vs mine..

			alpha#=alpha#-fade_alpha#

			If surf.alpha_enable=True
				glEnable(GL_BLEND)
				glDepthMask(GL_FALSE)
			Else
				glDisable(GL_BLEND)
			EndIf

			' blend modes
			Select blend
				Case 0
					glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA) ' alpha
				Case 1
					glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA) ' alpha
				Case 2
					glBlendFunc(GL_DST_COLOR,GL_ZERO) ' multiply
				Case 3
					glBlendFunc(GL_SRC_ALPHA,GL_ONE) ' additive and alpha
			End Select
			
			glDepthMask(GL_TRUE)


Last edited 2011


AdamRedwoods(Posted 2011) [#43]
Do you have a simple example of the Z-ordering problem? That would help, because I haven't seen that specific problem yet.

I have a simple example of the "flickering problem". Your version above does not solve the flickering problem. We may have to combine the two solutions as they seem to be separate problems.

Flickering problem example, when changing alpha values for instanced entities:


Last edited 2011

Last edited 2011


AdamRedwoods(Posted 2011) [#44]
Ok, I thought about FBEpyon's problem:

If a vertex is set with an alpha value, then yes, you will have some strange Z-order problems. This is because when miniB3D does it's "alpha" sorting with the TMesh.Alpha() method, it does not check for vertex alpha, only surface alpha (in brushes).

In PBEpyon's fix, we are ALWAYS turning on glDepthMask(GL_TRUE) for every render. I'm not sure if we want to do this. This causes some problems with my game, especially with all transparent cylinders.

A possible workaround would be to turn on the surface's force alpha flag if we set a vertex to alpha. This can be done using :
surface.brushFX(32)


FBEpyon, does this fix work for you without always setting glDepthMask(GL_TRUE)?


Difference(Posted 2011) [#45]
Because the official version is now on github, smallfixes version is now officially retired.

You can read about the GitHub version here : http://blitzmax.com/Community/posts.php?topic=96520#1117278

or go straight to https://github.com/si-design/minib3d

Please keep submitting your fixes to the official version and resubmit any I didn't get in!


AdamRedwoods(Posted 2011) [#46]
Did the flickering fix get in there? Could someone test that above code I posted (post #43 above)?