Hello. I seem to have a problem with my texturemapping in Blitz3D - well, not specifically to do with Blitz3D, but it's still a problem I have.
When I create a model in 3D Studio MAX and bring it into Blitz3D as an animated (or non-animated as some stand right now) MD2, using QTiP, the texturemaps on some polygons in the model are distorted. Now I would've expected there to be some problems with importing a model into Blitz (after all it never looks exactly the same, does it?). However, I have no idea how to fix it - I've used the ResetXForm utility before mapping the UVWs, and it's not the whole model that appears distorted - just a few polygons.
If you need to know what's happening with my model, I can take a screen capture of what it looks like in 3D MAX and Blitz to show the problems..
If anyone can help, I would most appreciate it.
Screenshots are nice but posting the actual model would be better. I have a couple thoughts of what could be going on but I'ld like to see the model for myself.
http://sovanjedi.rpgone.com/SeivadNojProblems.zipThere's the .zip file with the .md2 and .3ds models in, the texture map, and screens of what I get from the image before and after exporting to MD2 and displaying in Blitz.
(I bet it's something reeeeeally obvious I've done. Typical, really..)
Actually, I have no idea what is wrong with your display of the model. The md2 you posted looks fine. I loaded it in Blitz and it looks fine. Perhaps you are messing up the model or the texture in code.
From your screenshots I assume the problem areas you refer to are on his forehead.
That's the one, the forehead. The broken seams around the edges of his sleeves and so forth are fixable, it's really the forehead that's the problem spot.
I also have another model that this happens on, but to be honest it doesn't actually look that noticeable so I didn't do anything about it. So I'm for your suggestion that I'm messing the code up somehow.
I'll try and mess around with the code to see if I can fix it there. Is there anything specific you need to do when applying a Texture to an MD2, other than loading it into a variable beforehand and applying it on? That's what I'm doing at the moment.
Could you perhaps post sample code which produces the problem display you posted a screenshot of? I'll see if it produces the problem on my system. If not it must be a bug/incompatibility with your computer; post that to Bug Reports.
Rightyho. Here's the code. Now let's see if I can remember how to do that funky "green-on-black" thing when people post code:
;------------------------------------------------------------
;NOTE: These variables are put here only for the purpose of faster testing. Once finished, get rid of 'em!
Const FPS=60
Const width=800,height=600,depth=0
Global mode=0
Global a=255
Global lightenvcolour=0
;------------------------------------------------------------
;------------------------------------------------------------
;Starter pointers - keep these in to be able to run the application.
Graphics3D width,height,depth,mode
SetBuffer BackBuffer()
SeedRnd = MilliSecs()
Function Update_Player_Cam()
;-------------------------------
; + and - to change sensitivity
If KeyDown(13) Then cam_sens=cam_sens-1
If KeyDown(12) Then cam_sens=cam_sens+1
If cam_sens<=0 Then cam_sens=1
;
;-------------------------------
; Zooming function
If MouseDown(1)
zoom=(MouseYSpeed()-zoom)/13+zoom
mouseXs=(0-mouseXs)/cam_sens+mouseXs
mouseYs=(0-mouseYs)/cam_sens+mouseYs
Else
zoom=(0-zoom)/13+zoom
mouseXs=(MouseXSpeed()-mouseXs)/cam_sens+mouseXs
mouseYs=(MouseYSpeed()-mouseYs)/cam_sens+mouseYs
EndIf
MoveEntity chaseCam,mouseXs,mouseYs,zoom
PointEntity chaseCam,chaseCamPivot
MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
End Function
Function CreatePlayer.Player(posx,posy,posz,rotx,roty,rotz,player_no)
p.Player = New Player
p\entity = CreatePivot()
p\player_no = player_no
p\model = LoadMD2("Models/player"+player_no+"/player"+player_no+".md2")
p\texture = LoadTexture("Models/player"+player_no+"/player"+player_no+"text.bmp")
EntityTexture p\model,p\texture
FreeTexture p\texture
AnimateMD2 p\model,1,0.7,1,40
ScaleEntity p\model,.08,.08,.08
p\player_x = posx
p\player_y = posy
p\player_z = posz
MoveEntity p\model,p\player_x,p\player_y,p\player_z
RotateEntity p\model,rotx,roty,rotz
End Function
Type Player
Field entity,model,texture
Field player_x#,player_y#,player_z#,player_no,stats
End Type
;------------------------------------------------------------
Global playerCam,CameraPivot,mouseXs#,mouseYs#,zoom#,cam_sens
;------------------------------------------------------------
;The juicy bits
SetBuffer BackBuffer ()
p.Player=CreatePlayer(0,5,0,0,180,0,1)
Global chaseCam=CreateCamera()
Global chaseCamPivot=CreatePivot()
CameraViewport chaseCam,0,0,GraphicsWidth(),GraphicsHeight()
PositionEntity chaseCam,0,20,30
PositionEntity chaseCamPivot,0,8,0
cam_sens=5
EntityRadius chaseCam,4
EntityType chaseCam,1
Repeat
Update_Player_Cam()
;----------------------------------
UpdateWorld
RenderWorld tween
Text 0,0,"Press the '+' and '-' keys to set the camera's sensitivity."
Text 0,10,"Camera sensitivity="+cam_sens
Text 0,20,"CameraX="+EntityX(chaseCam)
Text 0,30,"CameraY="+EntityY(chaseCam)
Text 0,40,"CameraZ="+EntityZ(chaseCam)
Text 0,50,"Press the X button to destroy the player and replace with a different character."
Flip
Until KeyDown(1)
End
This is actually tested on two computers, with the same results, so it must be the coding. What could be the problem?
Here's a screenshot using the model you posted and that code:
www.3darteest.com/test.jpg
As you can see, no problem on the forehead. Maybe you need to update Blitz?
Maybe I should, though I could've sworn I have the latest update already...
Thanks a lot for your time and help, Joe.
EDIT: I've been using version 1.64 all this time - d'oh!
Did updating fix your problem? When I suggested updating I didn't know if it would help, I was just tossing out stuff to check.
Oh sorry, forgot to reply. Yes it did help, thank you.
And all this time I wondered why I couldn't open .b3d files either...
Thank you once again.