September 23, 2019, 03:09:04 PM

Author Topic: Textures  (Read 366 times)

Offline Pfaber11

  • Sr. Member
  • ****
  • Posts: 280
    • FABERS GAMES
Textures
« on: August 24, 2019, 11:47:37 AM »
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.
 

Offline Pfaber11

  • Sr. Member
  • ****
  • Posts: 280
    • FABERS GAMES
Re: Textures
« Reply #1 on: August 24, 2019, 01:50:17 PM »
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() )
 
Code: [Select]
 
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



Offline TomToad

  • Sr. Member
  • ****
  • Posts: 429
Re: Textures
« Reply #2 on: August 24, 2019, 03:05:14 PM »
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.

Offline Pfaber11

  • Sr. Member
  • ****
  • Posts: 280
    • FABERS GAMES
Re: Textures
« Reply #3 on: August 24, 2019, 03:52:26 PM »
Not sure if this'll work but here we go these are the files.

Offline Pfaber11

  • Sr. Member
  • ****
  • Posts: 280
    • FABERS GAMES
Re: Textures
« Reply #4 on: August 24, 2019, 03:55:17 PM »
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. ?

Offline Naughty Alien

  • Hero Member
  • *****
  • Posts: 630
Re: Textures
« Reply #5 on: August 24, 2019, 04:14:37 PM »
..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..

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 2115
Re: Textures
« Reply #6 on: August 24, 2019, 04:19:29 PM »
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.
Until the next time...

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 2000
Re: Textures
« Reply #7 on: August 24, 2019, 04:20:49 PM »
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.
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).
MacOS Mojave, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB.
Linux Mint 19.1, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).
Raspbian Buster, pi4 4Gb RAM,1.5Ghz

Offline Pfaber11

  • Sr. Member
  • ****
  • Posts: 280
    • FABERS GAMES
Re: Textures
« Reply #8 on: August 24, 2019, 05:51:55 PM »
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 .

Offline Pfaber11

  • Sr. Member
  • ****
  • Posts: 280
    • FABERS GAMES
Re: Textures
« Reply #9 on: August 24, 2019, 07:34:31 PM »
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 . 

Offline Naughty Alien

  • Hero Member
  • *****
  • Posts: 630
Re: Textures
« Reply #10 on: August 25, 2019, 02:31:44 AM »
..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..

Offline GaborD

  • Sr. Member
  • ****
  • Posts: 296
Re: Textures
« Reply #11 on: August 25, 2019, 05:01:14 AM »
The paul.x file you posted doesn't seem load correctly in NB either.


Offline Pfaber11

  • Sr. Member
  • ****
  • Posts: 280
    • FABERS GAMES
Re: Textures
« Reply #12 on: August 25, 2019, 11:34:07 AM »
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 .

Offline TomToad

  • Sr. Member
  • ****
  • Posts: 429
Re: Textures
« Reply #13 on: August 25, 2019, 02:12:13 PM »
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.

Offline TomToad

  • Sr. Member
  • ****
  • Posts: 429
Re: Textures
« Reply #14 on: August 25, 2019, 03:20:47 PM »
Just downloaded Wings 3d.  There is an option for saving UV coordinates with the .x file.  Seems to work fine for me.
Code: [Select]
// 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.