This may be useful information to some people. Apologies if it is already well known, I am still fairly new to blitz
I have been frustrated by programs that aim to display 3d models.
They are often slow to use or rely on awkward file selection, or have parameters fixed that I do not like.
I thought it might be better to use the familiar windows explorer to move through directories and just click on any 3d file for a quick view.
A windows programmer suggested the command line would be the way to go, and it turned out that Blitz 'commandline' string holds the full file heirachy and it can ( or should) load the model selected.
EXCEPT THAT ... 2 hours of testing and complete frustration later it finally dawned that ( despite expectation and appearances during tests!) the quotation marks in the command line string were being retained and doubling the quote marks the final 'load mesh' string . Grrr.
The modification of the initial string, as in the simple program included at the end of this post, solved the problem.
The program may also be useful for the way it uses an inertia effect with object rotations.
Feel free to use and add any extra modifiers as desired.
If you wanted to avoid associating x and 3ds files with this sort of program you could perhaps call windows explorer from within a new version and get the command line that way. Perhaps it is best to stay simple, as the point of this was to quickly skip through files.
--------------------------------------------
One problem emerged in viewing models and I would appreciate it if an expert could tell me if there is a way to make 'transparency' in standard 3ds model texture work properly in blitz.
As far as i can tell, a one sided transparent texture appears transparent from that side only. From the other side it appears opaque.
eg. a cockpit canopy is 'see thru' on one side, but what you also see is whatever base colour was used on the other side of the canopy.
You can use a double sided transparent texture, but that simply means you 'see thru' to the base colour even on near faces .. NO transparency.
Transparency in .X file textures work perfectly well with blitz, so it is something of a puzzle.
Any suggestions for a cure?
Cheers David L.
================== basic program follows below =====================
; 'Quickview' .. by David Lawrence june 2007.
; you need to make it into an executable and 'associate' the exe. with X or 3ds files in windows explorer for it to work.
Graphics3D 800, 600, 0, 2
SetBuffer BackBuffer()
cam=CreateCamera ()
light=CreateLight()
TurnEntity light,60,70,0
CameraClsColor cam,100, 105,90 ; background colour
AmbientLight 150,150,150 ; degree of shadow dark
PositionEntity cam, 0,0,0
CameraRange cam, .1,70000
CameraZoom cam, 1.8
init$=CommandLine$()
; to remove quotes
length=Len(init$)
If length =0 Then length =5 ; (to avoid errors when testing non executable)
less = length -1
more=length-2
temp$= Right$(init$,less)
final$=Left$(temp$,more)
model= LoadMesh (final$)
;model= LoadMesh ("modelofyourown.x"); (this line used for non exe testing)
widf#= MeshWidth(model)
hite#= MeshHeight(model)
If (hite*.75) > widf
dist#= hite# *1.7 *-1
Else
dist#= widf*1.7 *-1
EndIf
hold#=dist#
change#=dist#/150
abit#=0
xr#=0:yr#=0:zr#=0:
frameTimer=CreateTimer(40)
.beginloop
;--------------------START LOOP =========================
While Not KeyHit(1)
dist#=dist#+abit#
abit#=abit#*.76
PositionEntity cam, 0,(hite#/2),dist#
zr#=zr#+roll#
roll#=roll#*.8
yr#=yr#+spin#
spin#=spin# *.8
RotateEntity model,xr#,yr#,zr#
RenderWorld
Color 255,255,255
Text 20,5,"Turn model left/right arrow keys"
Text 20,20,"Roll model < > keys"
Text 500, 5, "Zoom IN ... up arrow key "
Text 500, 20, "Zoom OUT .. down arrow key "
Text 20, 580, "RESET TO INITIAL STATE .. R "
Text 500, 580, "toggle wireframe .. space "
Color 255,100,100
Text 20,110,"Triangles.."+TrisRendered()
Text 20, 130, "height ..." + hite#
Text 20,150, "width .. " + widf#
If KeyHit(1) End
If KeyHit(28) End
If KeyDown(200) abit#=abit#-change# ; zoom out on Arrows
If KeyDown(208) abit#=abit#+change# ; zoom in
If KeyDown(203) spin#=spin#+.5 ; turning on arrow L, R
If KeyDown(205) spin#=spin#-.5
If KeyDown(51) roll#=roll#-.5; < roll
If KeyDown(52) roll#=roll#+ .5; >
If KeyDown(19) xr#=0:yr#=0:zr#=0:dist#=hold#:abit#=0:roll#=0
If KeyHit( 57 )=True Then enable=1-enable
WireFrame enable
WaitTimer(frameTimer)
Flip
Wend
; ----------------------------------------- loop end ------------------------------
I have been frustrated by programs that aim to display 3d models.
They are often slow to use or rely on awkward file selection, or have parameters fixed that I do not like.
I thought it might be better to use the familiar windows explorer to move through directories and just click on any 3d file for a quick view.
A windows programmer suggested the command line would be the way to go, and it turned out that Blitz 'commandline' string holds the full file heirachy and it can ( or should) load the model selected.
EXCEPT THAT ... 2 hours of testing and complete frustration later it finally dawned that ( despite expectation and appearances during tests!) the quotation marks in the command line string were being retained and doubling the quote marks the final 'load mesh' string . Grrr.
The modification of the initial string, as in the simple program included at the end of this post, solved the problem.
The program may also be useful for the way it uses an inertia effect with object rotations.
Feel free to use and add any extra modifiers as desired.
If you wanted to avoid associating x and 3ds files with this sort of program you could perhaps call windows explorer from within a new version and get the command line that way. Perhaps it is best to stay simple, as the point of this was to quickly skip through files.
--------------------------------------------
One problem emerged in viewing models and I would appreciate it if an expert could tell me if there is a way to make 'transparency' in standard 3ds model texture work properly in blitz.
As far as i can tell, a one sided transparent texture appears transparent from that side only. From the other side it appears opaque.
eg. a cockpit canopy is 'see thru' on one side, but what you also see is whatever base colour was used on the other side of the canopy.
You can use a double sided transparent texture, but that simply means you 'see thru' to the base colour even on near faces .. NO transparency.
Transparency in .X file textures work perfectly well with blitz, so it is something of a puzzle.
Any suggestions for a cure?
Cheers David L.
================== basic program follows below =====================
; 'Quickview' .. by David Lawrence june 2007.
; you need to make it into an executable and 'associate' the exe. with X or 3ds files in windows explorer for it to work.
Graphics3D 800, 600, 0, 2
SetBuffer BackBuffer()
cam=CreateCamera ()
light=CreateLight()
TurnEntity light,60,70,0
CameraClsColor cam,100, 105,90 ; background colour
AmbientLight 150,150,150 ; degree of shadow dark
PositionEntity cam, 0,0,0
CameraRange cam, .1,70000
CameraZoom cam, 1.8
init$=CommandLine$()
; to remove quotes
length=Len(init$)
If length =0 Then length =5 ; (to avoid errors when testing non executable)
less = length -1
more=length-2
temp$= Right$(init$,less)
final$=Left$(temp$,more)
model= LoadMesh (final$)
;model= LoadMesh ("modelofyourown.x"); (this line used for non exe testing)
widf#= MeshWidth(model)
hite#= MeshHeight(model)
If (hite*.75) > widf
dist#= hite# *1.7 *-1
Else
dist#= widf*1.7 *-1
EndIf
hold#=dist#
change#=dist#/150
abit#=0
xr#=0:yr#=0:zr#=0:
frameTimer=CreateTimer(40)
.beginloop
;--------------------START LOOP =========================
While Not KeyHit(1)
dist#=dist#+abit#
abit#=abit#*.76
PositionEntity cam, 0,(hite#/2),dist#
zr#=zr#+roll#
roll#=roll#*.8
yr#=yr#+spin#
spin#=spin# *.8
RotateEntity model,xr#,yr#,zr#
RenderWorld
Color 255,255,255
Text 20,5,"Turn model left/right arrow keys"
Text 20,20,"Roll model < > keys"
Text 500, 5, "Zoom IN ... up arrow key "
Text 500, 20, "Zoom OUT .. down arrow key "
Text 20, 580, "RESET TO INITIAL STATE .. R "
Text 500, 580, "toggle wireframe .. space "
Color 255,100,100
Text 20,110,"Triangles.."+TrisRendered()
Text 20, 130, "height ..." + hite#
Text 20,150, "width .. " + widf#
If KeyHit(1) End
If KeyHit(28) End
If KeyDown(200) abit#=abit#-change# ; zoom out on Arrows
If KeyDown(208) abit#=abit#+change# ; zoom in
If KeyDown(203) spin#=spin#+.5 ; turning on arrow L, R
If KeyDown(205) spin#=spin#-.5
If KeyDown(51) roll#=roll#-.5; < roll
If KeyDown(52) roll#=roll#+ .5; >
If KeyDown(19) xr#=0:yr#=0:zr#=0:dist#=hold#:abit#=0:roll#=0
If KeyHit( 57 )=True Then enable=1-enable
WireFrame enable
WaitTimer(frameTimer)
Flip
Wend
; ----------------------------------------- loop end ------------------------------