Unit is invisible (no textures showing)

Unit is invisible (no textures showing)

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
nawoa
Posts: 9
Joined: 24 Mar 2009, 00:38

Unit is invisible (no textures showing)

Post by nawoa »

solved questions wrote:Working on a small project. Made a model and texture, put them into Balanced Annihilation (for the sake of having a working framework to test with) by replacing the Arm Flash.

So I have "armflash.s3o" in the objects3d folder, changed the object name in armflash.lua from "armflash" to "armflash.s3o". Then I copied the two textures "prototype3_1x.dds" and "prototype_2x.dds" to the unittextures directory. I assigned these textures in UpSpring, and they appear properly in that program. Also, I named my unit's object to be "base" in upspring to ensure that it at least appears.

The unit loads in the game and if I put my mouse cursor over it I can see a halo that shows the unit's proper working model (mine, not the original Flash). It seems everything is fine except there's no texture.

I'm doing this as a proof of concept before working on anything else, but I'm stuck at this point. I realize the unit should not function properly without a script, but I just want the unit itself to appear as a starting point. And it does, but no textures show.

Does anyone know what I'm doing wrong?

One note, I'm using 2048x2048 as my texture size... I don't see why this would be a problem but I thought I should say. Also, if it helps to diagnose the problem, I only seem to be able to select the unit by either dragging a box around where it should be, or zooming in close and hovering over a very small area with my mouse.

I've attached a picture demonstrating the problem.
Problem has been solved! Thank you! More questions further down though.
Last edited by nawoa on 13 May 2011, 18:29, edited 4 times in total.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: Unit is invisible (no textures showing)

Post by FLOZi »

Did you set radius and height of the s3o?

Does your texture 2 have an alpha channel? Texture 2 alpha is 2-bit transparency.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: Unit is invisible (no textures showing)

Post by jK »

THE UNIT IS CLOAKED!
User avatar
Beherith
Posts: 5145
Joined: 26 Oct 2007, 16:21

Re: Unit is invisible (no textures showing)

Post by Beherith »

jK wrote:THE UNIT IS CLOAKED!
The unit loads in the game and if I put my mouse cursor over it I can see a halo that shows the unit's proper working model
Seems like xray shader to me.

The alpha channel of texture to should be completely white.
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: Unit is invisible (no textures showing)

Post by oksnoop2 »

Maybe try reducing the size of your texture to 512 and see if it appears.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: Unit is invisible (no textures showing)

Post by SinbadEV »

(minor but important spelling correction)
Beherith wrote:The alpha channel of texture TWO should be completely white.
+1

Wait for someone who know what they are talking about to confirm as I haven't modeled an s3o for years but:

This is my bet. If I recall correctly Alpha channel of texture two determines transparency (alpha of texture 1 determines team-color mix)... so you likely have an all black alpha layer (or no alpha layer... seem to recall this is the same thing) in texture two.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: Unit is invisible (no textures showing)

Post by FLOZi »

It's like people can't even read my posts. 8)
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Unit is invisible (no textures showing)

Post by Forboding Angel »

FLOZi wrote:Did you set radius and height of the s3o?

Does your texture 2 have an alpha channel? Texture 2 alpha is 2-bit transparency.
This is why. I've done it myself many times.
nawoa
Posts: 9
Joined: 24 Mar 2009, 00:38

Re: Unit is invisible (no textures showing)

Post by nawoa »

solved questions wrote:It seems that the issue was that the model did not have a center x/y/z, radius, or height set in UpSpring. If I'm correct, one gridline equals 5 units...?

Thank you for the help so far, I have a fresh set of questions!

It's been a struggle even getting to this point; the wiki has a lot of outdated information. I don't want to trust it as a source. Can someone knowledgeable tell me if this is correct:

1) Textures 1 and 2 can be named anything, as long as the names are specified in the s3o using UpSpring. Textures should be named simply as "texture1.dds" for example, not "unittextures/texture1.dds".

2) Texture 1's alpha channel areas will show as team color. The texture should be located in the unittextures directory in the mod hierarchy in DDS-DXT3 format.

3) Texture 2's red areas are self-illumination, green areas are reflectivity, and alpha channel is transparency.

Assuming all of the above is correct, what is Texture 2's blue channel for, anything?

It appears that unit script files are in BOS and COB format; I read elsewhere that lua was used. Can the BOS file be simply renamed lua and still function or must it be rewritten? Is there an example lua file somewhere which demonstrates how functions are to be written?

Does Spring have an SDK of any kind - small demonstration dataset which gives a couple of working examples using the most up-to-date specifications?

Is it possible to use more than one set of textures for a single unit? For example, have a 256x256 texture for one section and a 512x512 texture for another? If not by default, can this be accomplished using some sort of unit-combining trick, etc?

Do textures need to be of arbitrary sizes or aspect ratios? Can texture1 and texture2 be different sizes, for example 512x512 and 256x256?

Finally, during my now-successful testing, I found that units have a tendency to jitter and sort of fight to occupy the same area while moving in a group. I tried with my "new" unit (armflash), its companion (corgator) and a large unit (corgol) to ensure this was not an issue with my model being too big or something of that nature. All three units had the same issue.

I remember playing a game which used the Spring engine years ago and I didn't experience this issue at the time. Is this an engine problem or a result of a problem in Balanced Annihilation? In either case, can someone describe a simple workaround so I can complete my testing?

If the problem is pathfinding, what is used to determine paths, the size of the unit as defined in UpSpring or the size of the unit's footprint as defined in its descriptor file? Is it the same as the unit's weapon collision sphere as I see with alt-b? Can the collision sphere be replaced with another type of object for the purpose of weapon impacts, such as a cube, or can the sphere be deformed in any way? Perhaps separate hitbox objects in the model file?
All questions answered.
Last edited by nawoa on 13 May 2011, 18:28, edited 3 times in total.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: Unit is invisible (no textures showing)

Post by SinbadEV »

nawoa wrote:Does Spring have an SDK of any kind - small demonstration dataset which gives a couple of working examples using the most up-to-date specifications?
There is this thing:
Tutorial Game for new modders
Topic: http://springrts.com/phpbb/viewtopic.php?f=14&t=25831
Website: http://code.google.com/p/springtutorialgame/
nawoa
Posts: 9
Joined: 24 Mar 2009, 00:38

Re: Unit is invisible (no textures showing)

Post by nawoa »

solved questions wrote:Thanks, it looks like exactly the sort of thing I need.

One new question: Since UpSpring is given the model's center Y position, why does it also need to know the model height? Isn't it naturally going to be 2x the center Y position? This makes me think it must be used for something else... does anyone know what?

Does the engine have any sort of LoD system?
ANSWERED


Where are the game settings kept, in a file somewhere or the windows registry? If it's the registry, can this be done with a file instead somehow?
Last edited by nawoa on 13 May 2011, 18:55, edited 8 times in total.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Unit is invisible (no textures showing)

Post by Forboding Angel »

Yes, the unit must always have a height. A lot of gadgets will also attempt to get unit height for this or that, so it pays to set it correctly.

Height is used for healthbar position for example.

LOD's are generated. There are big fights that break out over what format to use for unit textures. DDS is not as nice looking (though on a large scale the difference may not be noticeable at all) or as easy to work with as PNG but it will allow you to define your own mips, etc if you prefer that level of control (if you need help with your textures from other community members, png is prolly the better format, as many of us detest working with dds).

You can not have multiple textures for texture1, no, however, it is possible to use one texture for many units. For example, in Evolution RTS we use what we call "legos", which is a giant set of pre-fabricated parts that we put together to make units. They are available to download and what you can make with them pretty much the sky is the limit. They are already uvmapped and there is a very nice texture for them you can use (or make your own).

More info here: http://springrts.com/phpbb/viewtopic.php?f=9&t=22283
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: Unit is invisible (no textures showing)

Post by FLOZi »

nawoa wrote:It seems that the issue was that the model did not have a center x/y/z, radius, or height set in UpSpring. If I'm correct, one gridline equals 5 units...?
Radius is the important one iirc, but the others should be set too.
Thank you for the help so far, I have a fresh set of questions!

It's been a struggle even getting to this point; the wiki has a lot of outdated information. I don't want to trust it as a source. Can someone knowledgeable tell me if this is correct:
Sad but true. Some of us are trying to clean it up but it's a long process.
1) Textures 1 and 2 can be named anything, as long as the names are specified in the s3o using UpSpring. Textures should be named simply as "texture1.dds" for example, not "unittextures/texture1.dds".
This is correct.
2) Texture 1's alpha channel areas will show as team color. The texture should be located in the unittextures directory in the mod hierarchy in DDS-DXT3 format.
This is correct. Format is a matter of choice, but dds does have significant bonuses to offset the difficulty of working with it. (dxt3 or dxt5 is a choice I'm not too familiar with the details of)
3) Texture 2's red areas are self-illumination, green areas are reflectivity, and alpha channel is transparency.
All correct.
Assuming all of the above is correct, what is Texture 2's blue channel for, anything?
Generally nothing. Some mods used to include their own shaders to separate reflectivity into reflectivity (green) and specular (blue) but I'm not sure if any still do this and if it would even work anymore.
It appears that unit script files are in BOS and COB format; I read elsewhere that lua was used. Can the BOS file be simply renamed lua and still function or must it be rewritten? Is there an example lua file somewhere which demonstrates how functions are to be written?
BOS is a completely different format to lua so it can't just be renamed. The first two links in further reading here: http://springrts.com/wiki/Animation-LuaScripting are a Lua Unit Script (LUS) tutorial.
Is it possible to use more than one set of textures for a single unit? For example, have a 256x256 texture for one section and a 512x512 texture for another? If not by default, can this be accomplished using some sort of unit-combining trick, etc?
Generally speaking no. You can (theoretically 8) ) do it by unit combining in a number of ways but you'll have to write the code yourself and have a good understanding of OGL (and such things as e.g. shadows may not be rendered correctly even then).
Do textures need to be of arbitrary sizes or aspect ratios? Can texture1 and texture2 be different sizes, for example 512x512 and 256x256?
The dimensions should probably be power-of-two, otherwise anything goes.
Finally, during my now-successful testing, I found that units have a tendency to jitter and sort of fight to occupy the same area while moving in a group. I tried with my "new" unit (armflash), its companion (corgator) and a large unit (corgol) to ensure this was not an issue with my model being too big or something of that nature. All three units had the same issue.

I remember playing a game which used the Spring engine years ago and I didn't experience this issue at the time. Is this an engine problem or a result of a problem in Balanced Annihilation? In either case, can someone describe a simple workaround so I can complete my testing?

If the problem is pathfinding, what is used to determine paths, the size of the unit as defined in UpSpring or the size of the unit's footprint as defined in its descriptor file? Is it the same as the unit's weapon collision sphere as I see with alt-b? Can the collision sphere be replaced with another type of object for the purpose of weapon impacts, such as a cube, or can the sphere be deformed in any way? Perhaps separate hitbox objects in the model file?
Welcome to Spring. There are some widgets which attempts to mollify 'jitteryness'. You can also experiment with the heatmapping tags in the movedefs. Generally speaking it is the footprint size set in the movedef (not the unitdef!) which determines pathing, unitdef footprints should be set to match these.

Ellipsoids, cylinders and boxes can be used, see http://springrts.com/wiki/Unit_collision_volumes . No model-object based hitbox objects currently.
nawoa
Posts: 9
Joined: 24 Mar 2009, 00:38

Re: Unit is invisible (no textures showing)

Post by nawoa »

answered questions wrote:Thanks for the link to the scripting wiki page, I think it will be very helpful. It looks like the example mod has some Lua scripting examples as well, I will examine them carefully.

To clarify, please tell me if I'm getting this 100% right:

1) the "hitbox" is used ONLY for weapon collisions, not for any other purpose whatsoever (definitely not pathfinding) EXCEPT for aircraft.

2) the "hitbox" is defined BY DEFAULT in UpSpring, but it can be overridden by parameters in the in the unit definition file.

How does this work in the case of aircraft? The wiki pages says the hitspheres are scaled down, is this the case for pathfinding as well as weapon collisions? Do aircraft use spheres exclusively for hit detection and/or pathfinding or can other shapes work without issue?

I notice that there's a type of "hitbox" called "CylY", which seems to imply that there are CylX, CylZ as well, is this the case?

Also, I do know a Spring-based game which didn't have the jittery issue, at least not so severely. This was years ago though, it may be possible the problem is due to engine changes in the meantime. Or maybe my mind is playing tricks on me. I'm going to work under the assumption that it's so bad in BA due to gameplay considerations of some kind which I may be able to avoid.
ANSWERED


Wiki also mentions you can have multiple hitboxes, but only goes so far as to say that it's possible and then literally devolves into "blabla"... Can you clarify?

Finally, one of my earlier questions wasn't answered and it's pretty important to my use. Where are Spring settings stored?

Thanks for all the help so far!
Last edited by nawoa on 13 May 2011, 18:38, edited 1 time in total.
User avatar
SanadaUjiosan
Conflict Terra Developer
Posts: 907
Joined: 21 Jan 2010, 06:21

Re: Unit is invisible (no textures showing)

Post by SanadaUjiosan »

I don't think its a great idea to cross out your previous posts... future people with problems often look on the forums for help, and while they can still read them it just makes it a little tougher.

Just a suggestion.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Unit is invisible (no textures showing)

Post by knorke »

hi
the "example mod" (spring tutorial game) and the hitbox wiki page are both by me... :roll:
So if there is unclear stuff or "...blabla" , it is because I did not know better and appearently nobody* else does either.
I notice that there's a type of "hitbox" called "CylY", which seems to imply that there are CylX, CylZ as well, is this the case?
mind = blown. I actually did not think about that but you are right.
I was wondering about the Y myself but somehow thought "CylY" was just a strange short form of "cylinder" :roll:
Actually it defines the rotation of the cylinder shaped hitbox, ie CylZ:
Image
so yes, CylX, CylZ exist. Just nobody* knows about it.
2) the "hitbox" is defined BY DEFAULT in UpSpring, but it can be overridden by parameters in the in the unit definition file.
yes. And as the wiki says, you can even change the hitbox with scripts during gameplay. ie if a unit unfolds/grows the hitbox can change to reflect that.
1) the "hitbox" is used ONLY for weapon collisions, not for any other purpose whatsoever
the unit radius is also used to decide if a mouse click was on a unit (i think)
(definitely not pathfinding)
yes.
EXCEPT for aircraft.
Afaik aircraft do not use hitboxes for pathing either. They just bump into each other like ground units do too, which can change their course. Aircraft do not seem to "path" around obstacles/units at all.
But typing /airmesh into chat shows some grid thing that aircrafts use to decide their flight height.

I think jittering during moving of units is partly the engine's pathfinding and partly the games.
Of course it is also everybody faults that nobody* knows what would be good settings in the unit files.

*documentation is fail. most of it is based on the trial & error by people who should be reading the wiki, not writing it.
nawoa
Posts: 9
Joined: 24 Mar 2009, 00:38

Re: Unit is invisible (no textures showing)

Post by nawoa »

Terrific, thanks for the answers. Sounds like I'll have some experimentation to do after all, but that's to be expected. I have a few questions left:

The wiki says you can have multiple hitboxes, and Knorke might've answered this or maybe not, I'm not sure. Is this to mean only that the hitboxes can be changed during gameplay, or that a unit can have multiple hitboxes simultaneously, like a sphere, a cube, and two cylinders all at once to fully outline a unit's model?

Next, where are Spring's settings stored?

My next questions are about some different ideas I have for making this project scale well on different hardware:

Is there an up-to-date list of console commands available, eg, for setting LOD distance, icon distance, etc, while the game is already running?

Does the engine render hidden objects in any manner? Example, if I had a 1,000,000 triangle sphere or something somewhere on a unit but it was hidden by default, would it impact CPU or GPU performance if it was hidden? What if it was unhidden, then hidden again? I would try this myself but I have only high-end and extreme low-end computers available to me at the moment and any testing I do would probably be heavily skewed, not very helpful. I'm concerned about both the CPU and GPU impact though.

edit: there's a lot of conflicting information, is there an up-to-date list of what Lua unit definition tags are read by the engine, preferably with any eccentricities explained? Default values as well would be very nice.
Last edited by nawoa on 13 May 2011, 19:29, edited 3 times in total.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: Unit is invisible (no textures showing)

Post by FLOZi »

nawoa wrote:The wiki says you can have multiple hitboxes, and Knorke might've answered this or maybe not, I'm not sure. Is this to mean only that the hitboxes can be changed during gameplay, or that a unit can have multiple hitboxes simultaneously, like a sphere, a cube, and two cylinders all at once to fully outline a unit's model?
A unit can have per-piece collision volumes (which will rotate and move with the pieces), using the

Code: Select all

usepiececollisionvolumes = true,
unitdef tag. There is a Spring.SetUnitPieceCollisionVolumeData API call, which can set the type, scale etc. Note that the arguments are changing in the next major Spring release (0.83)!

AFAIK the only game currently using this is S44, which simply uses the automatic box-volumes generated when the tag is turned on for the hull and turret pieces and disables all others. The (very simple) gadget which does this is here.
Next, where are Spring's settings stored?
springsettings.cfg, either in the Spring dir itself or in the data dir (the dir in user land where game/map packages are stored).

I'll let an engine dev answer the last two questions, though I suspect the answer to the last one is no.
there's a lot of conflicting information, is there an up-to-date list of what Lua unit definition tags are read by the engine?
Go to the source ;) :
https://github.com/spring/spring/blob/m ... nitDef.cpp
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Unit is invisible (no textures showing)

Post by knorke »

console commands:
http://springrts.com/wiki/UI_commands
obviously incomplete and fail.

http://answers.springlobby.info/questio ... est-my-mod
the console commands usefull for game testing
for setting LOD distance, icon distance
for terrain LOD: pos1/end keys.
icon distance has a command (don't know right it), maybe on wiki.
or try typing /icon <press tab> and see if it autocomplets to something.

render efficiency:
no idea. Ages ago somebody did tests to show that polycount is not that important and it is an often repeated mantra. Lots of pieces can cause slowdowns because the engine must calculate all their move/rotation matrix (at least i think/heard thats why, i dont know) even if the pieces are hidden.
I made some units with 30-100 piece count and while I noticed some lost fps on my 7 year old computer, everything remained totally playable even with many units.

Image
ie each track element on this unit is one piece.
a unit can have multiple hitboxes simultaneously, like a sphere, a cube, and two cylinders all at once to fully outline a unit's model
yes, possible. Ask Flozi how it is done, he uses it in the S44 game for the tanks. You can even detect which volume got it (like wheels, turret etc)
is there an up-to-date list of what Lua unit definition tags are read by the engine, preferably with any eccentricities explained? Default values as well would be very nice.
Can I use an image macro for this? please? pleease?
I chose haha_oh_wow.jpg
Post Reply

Return to “Game Development”