Posted: 13th Aug 2021 0:58
Hi,

I'm trying to texture my soccer field with multiple images. I get the field, goal nets and the ad boards textured, but the ad boards and goal nets image is pasting over the field. Here is my code and screen shot. Image shows the field textured underneath and then textured over. The ad boards and goal nets are from one image. What is wrong if anything? Can you use an image meant for 2 things? It is only detected as one mesh. I will be changing the ad boards images, because I won't be able to use them even though I paid for them. I just wanted to see how to get the image that had two things in it meant for two different parts of the object would work
+ Code Snippet
ObjMeshNum as integer

LoadImage(2, "Soccer Stadium\field.png")
LoadImage(3, "Soccer Stadium\Stadium_el.png")

`LOAD SOCCER FIELD
LoadObject(1, "Soccer Stadium\soccer.obj")


`TEXTURE SOCCER FIELD, GOAL NETS AND AD BOARDS

SetObjectMeshImage(1, ObjMeshNum, 2, 0)
SetObjectMeshImage(1, ObjMeshNum, 3, 1)
SetObjectMeshImage(1, ObjMeshNum, 3, 2)
do
    
	Print (ObjMeshNum)
    Print( ScreenFPS() )
    Sync()
loop


Posted: 13th Aug 2021 17:55
AGK's Object Loader is frustratingly basic... especially if you're coming from Dark BASIC Professional.
As I recall, when you load an object it will treat it as a Single Mesh, Static Object.

What's more is it will ALWAYS load as FVF338 (Position, Normal, UVSet0)
It won't even load the Vertex Diffuse Colour., not until you change the Mesh Format.
Animation is also handled as a separate (and in an archaic DAE Format)... honestly I think 3D Support was more or less an after thought., with the bare minimum of DBP Features being ported over.

In any case., a good practice to get into is to create a blank object with the correct FVF Format (which yeah it still uses identical to DBP / DirectX 9 despite being OpenGL)., then load individual Mesh as attached Object Mesh; then you can individually access and change things.

If you want to use a "Single Mesh" then just rearrange the UV Map., to use a Single Texture.

What the last number of the "SetObjectMeshImage" is., is essentially the Texture Stage used in Shaders... like DBP these come with pre-defined roles., but you can change these within a Shader.
Posted: 14th Aug 2021 1:00
In any case., a good practice to get into is to create a blank object with the correct FVF Format (which yeah it still uses identical to DBP / DirectX 9 despite being OpenGL)., then load individual Mesh as attached Object Mesh; then you can individually access and change things.


Are you suggesting to use the LoadObjectWithChildren? or Create ObjectPlane?
Posted: 15th Aug 2021 0:10
Have you tried changing ObjMeshNum? Add a print of GetObjectNumMeshes(1) to your loop and see how many meshes there are.
Posted: 15th Aug 2021 3:57
Have you tried changing ObjMeshNum? Add a print of GetObjectNumMeshes(1) to your loop and see how many meshes there are.



No, never crossed my mind to do that. I will try it in the morning though and post back
Posted: 15th Aug 2021 17:55
@jd_zoo

I tried changing ObjectMeshNum to equal 3 just to see what would happen. It failed.

Then I ran the GetObjectNumMeshes command and printed to screen and it says it has only 1
Posted: 15th Aug 2021 18:09
Try saving your model as a .x
Posted: 15th Aug 2021 23:15
Try saving your model as a .x


Can you do that in agk by just loading current format and saving as x code such as:

+ Code Snippet
 LoadObject(1, "field.obj")
SaveObject(1, "field.x")
Posted: 16th Aug 2021 8:45
No. You need to do it in a 3D proggy
Posted: 16th Aug 2021 10:59
Only modeling software I have found so far that supports .x format import or export or both is Wings3d. I'll give it a go after work today
Posted: 16th Aug 2021 18:50
You could also export 3 seperate objects
Posted: 16th Aug 2021 20:54
proof that blink has forgotten more than i'll ever know
The app will create individual models, or clones of models, based on their group name and create a table that records their position and various other properties.
Posted: 16th Aug 2021 21:11
You don't need .x ... sack it, grab blender 2.79 and export fbx, if you want your child objects to show as children in AppGameKit you have to parent them to a bone not a mesh, LoadObjectWithChildren seems to treat the armature as the main object and meshes as child objects, I got the Mixamo sword and shield animation set working just fine on my custom mesh with shield and sword attachments, when you export the object select the group then shift click the armature to make it the active object and set "FBX scale" in export options to stop the massive scale problem

it took me a while to figure this out, only about 5 years, the key here is blender 2.79, anything above that and fbx exports do not work, static objects are fine but AppGameKit says no to animated objects exported with any later version

Who would of thought planned obsolescence was built into software dev tools to!!!

The object loading system needs a massive overhaul or AppGameKit will become defunct very soon, GLTF is taking off and quickly becoming a standard .... But ... this is TGC .... We know what to expect ... nothing, until "DarkAgk 3 Max Studio Pro" hits the kickstarter ... why update it when we can reinvent it and make all our users buy it again!
Posted: 17th Aug 2021 0:07
uote: "The app will create individual models, or clones of models, based on their group name and create a table that records their position and various other properties."



he object loading system needs a massive overhaul or AppGameKit will become defunct very soon, GLTF is taking off and quickly becoming a standard .... But ... this is TGC .... We know what to expect ... nothing, until "DarkAgk 3 Max Studio Pro" hits the kickstarter ... why update it when we can reinvent it and make all our users buy it again!


I'm trying both of the above things and converting to .x format way. I will figure this out yet LOL

I have wondered for awhile, does it matter what bit version I use of blender 32/64 bit? Can people on 32 bit systems play my game once it is done if I have objects created with the 64 bit version? I know that 32 bit software will run on 64 bit, but wondered about objects thing. Should I use 32 bit blender or does it matter since it is just objects and not the whole software?
Posted: 17th Aug 2021 18:24
If, when you create your 3D object, you map textures to it from a single image, you only need load that single image for the object in AGK2.

For example here is a cube that has a different image for each face. I made in AC3D, unwrapped it, and assigned different areas of the image to each face. The image is similar to a texture atlas.
Posted: 17th Aug 2021 18:24
Slow forum today, I hit the post button twice.
Posted: 18th Aug 2021 2:27
If, when you create your 3D object, you map textures to it from a single image, you only need load that single image for the object in AGK2.


My issue is that my soccer field is made up of 8 objects in a scene. I have verious file formats of it I can use. When I load ones compatible with AppGameKit Classic it sees it as one object not 8. It only takes 2 images to texture all 8. One for the field and 1 for the goal nets and adboards. The goal nets and adboard image has both the goal net texture and adboards in the one image. No matter how I manipulate the textures it shows up looking like the image in my first post. So, I'm already doing as you are suggesting. I have one image loading that has both nets and aboards in it. It isn't working right
Posted: 18th Aug 2021 15:18
I just found out the the object doesn't have any bones with the following code. So does that mean I have to attach it to a bone? Like with this command?

FixObjectToBone

+ Code Snippet
ObjNumBones as integer

`LOAD SOCCER FIELD
LoadObjectWithChildren(1, "Soccer\soccer.obj")
GetObjectNumBones(1)


do
    
    Print (ObjNumBones)
    Print( ScreenFPS() )
    Sync()
loop
Posted: 18th Aug 2021 18:40
I have wondered for awhile, does it matter what bit version I use of blender 32/64 bit?


No, that only applies to binary executables, media files are xBit independent.

I just found out the the object doesn't have any bones with the following code.


ok i see what your trying to do, its a static object with no animations right, but uses multiple textures??

if that is the case the answer is simple, just export each object on its own depending on what texture it uses and load them into agk stacked (one on top of the other)

in blender hit shift+c to center the cursor, right click each model part and set origin>>3d cursor and group them into texture sets when you export, AppGameKit will use this origin point and place it at 0,0,0, pick one object (probably the pitch) and fix the rest of the bits to it with FixObjectToObject, now you only need to move the pitch and everything follows ....

or, the slightly more complex way but also the recommended way, for each object create another UVMap, unwrap and bake to a single texture

The How:
Bookmark this guy, he knows his stuff in blender and I learned bucket loads from him
Posted: 19th Aug 2021 1:02
@PartTimeCoder

ok i see what your trying to do, its a static object with no animations right, but uses multiple textures??


Yes, you are right

Thanks for the info and video. I'm currently trying to follow the video, but not easy for me. He is using blender 2.80 and I'm using 2.79. He has his UI set up the way he wants it and since it is different than the default I have started from doesn't make it easy to find things. I'm dealing with it though slowly, but surely LOL. I'll post back when I succeed or fail lol. I hope this works.