Textures

Started by Pfaber11, August 24, 2019, 11:47:37

Previous topic - Next topic

Pfaber11

Hello I'm having a problem with texturing a model. when I use a model I've bought in the 3d asset pack I can change and play with the textures and get some promising results . However when I create my own models using wing3d and save it as an .x object then I try to apply a texture it displays as a blank model with no texture. I used the .x format because that's what TGC have used in the 3d asset pack. The png textures are a 200x200 .png file . Can anybody throw any light on this. Once I've sorted this out it's shader time.
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Pfaber11

#1
Here's my code for putting the texture on but it just won't work. I guess I could consider just using plain coloured models but really need to get this texture thing down . It works fine with models I've purchased but not with my own models . 
    Print( ScreenFPS() )
   
diffusetexture1 = LoadImage("MAZEGAME.png")
myobject1 = LoadObject("paul.X")
SetObjectImage(myobject1,diffusetexture1,1)
//SetObjectColor(myobject1,100,0,0,0)
SetCameraPosition(1,410,400,100)
SetObjectPosition(myobject1,420,400,135)
sync()

do
MoveObjectLocaly(myobject1,-.1)

RotateObjectlocalx(myobject1,1)
RotateObjectlocalz(myobject1,1)
RotateObjectlocaly(myobject1,1)
Print( ScreenFPS() )

if getobjecty(myobject1) <= 380
setobjectposition(myobject1,420,400,135)

endif
sync()
loop



HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

TomToad

Try changing SetObjectImage(myobject1,diffusetexture1,1)
to SetObjectImage(myobject1,diffusetexture1,0)

Also make sure that filenames are correct and in the correct folder.  Check case as well.

You may be able to get a better answer from the agk forums than here.
If you still can't get it to work, it might help if we have a copy of your .x file and texture so we can see what may be wrong.
------------------------------------------------
8 rabbits equals 1 rabbyte.

Pfaber11

Not sure if this'll work but here we go these are the files.
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Pfaber11

#4
I have tried all I can think of and tried using a .obj file but get the same results. When I export the model to .x or .obj it asks me if I want to use .png for texture and I say yes so don't get it . maybe it's wings 3d but I doubt it . Does anybody here use wings 3d. ?
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Naughty Alien

#5
..well..AGK is somewhat a mystery..i have had long time messing with loading simple cube (b3d) with lightmap texture created for it..none of commands work at all, while same cube worked just fine in any other 3d renderer i have had avail to try..most bizarre moment was, when i realized that example supplied by AGK, uses lightmap on a OBJ format which doesnt support 2nd UV map channel, while those which does (X, B3D), simply doesnt work..after that i just dropped whole thing as i had no patience to bother myself with figuring out something straightforward as applying 2 textures on a cube .. im curious to hear how it will work out for you..

Qube

When I did the Comet Killer game I exported in obj format but I had to texture on UV2 rather than UV1. No idea why I needed to do that but it worked.
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Steve Elliott

#7
AGK is great for 2D with Box2D built-in and a very simple language that runs on many platforms, as for full 3D features?  Not so much.

Quote
When I did the Comet Killer game I exported in obj format but I had to texture on UV2 rather than UV1. No idea why I needed to do that but it worked.

Hopefully that is of help, some documentation clarification would be good, rather than Qube and NA guessing lol.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Pfaber11

ok guys thanks for the input . I just don't get why it works with TGC 3d assets but doesn't work with my own . I Think I'll have to try out all the formats and see what I can come up with . I'll report back when I get it sorted .
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Pfaber11

#9
Well I thought it might have something to do with wings 3d so got the latest blender 2.8 and it's still got the same problems so nothing to do with the creation software which is good as I really like the simplicity of wings 3d and will be happy to keep using it . I'm sure blender 2.8 is very good indeed but I find it a little too complicated. I also use mtpaint for the same reasons .
So as it stands I am no closer to a solution . If I have any progress I'll let you know . Might try TGC forum and see what they've got to say . 
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Naughty Alien

..i have used 3dsmax for models (X, OBJ, FBX), and none worked with AGK..then tested with GILES and exported lightmaps and all works fine in several different engines..but not with AGK , and i did follow exact documentation instruction...after that i have deleted whole thing and havent look back..

GaborD

The paul.x file you posted doesn't seem load correctly in NB either.


Pfaber11

#12
I just tried to put a texture onto cubes spheres and cones and it works no problem so it's something to do with the models .
The textures also work with the models supplied in the TGC 3d asset pack . So somehow it's something to do with the models themselves . I've tried .obj .3ds .x files and it just won't work. The models display but without the texture. I'm missing something . Anyway if anybody could throw some light on the matter I would be most grateful .
The reason I used the .x file is that's what TGC use in their asset pack .
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

TomToad

The paul.x file has no texture UV coordinates set.  That is why you don't see anything when you add the texture.  Is there an option when you save to export UV or texture with the .x file?
------------------------------------------------
8 rabbits equals 1 rabbyte.

TomToad

Just downloaded Wings 3d.  There is an option for saving UV coordinates with the .x file.  Seems to work fine for me.

// Project: paul
// Created: 2019-08-25

// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "paul" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts

cyl = LoadObject("cyl.x")
text = loadimage("Made-with-AppGameKit-Logo-1024px.png")
SetObjectMeshImage(cyl,1,text,0)
SetObjectScale(cyl,2,2,2)

SetClearColor(0,255,255)
do
   
RotateObjectLocalY(Cyl,1)
    Sync()
loop

------------------------------------------------
8 rabbits equals 1 rabbyte.