Page 4 of 5
Re: Per-object textures for s3o
Posted: 13 Jun 2008, 03:36
by Warlord Zsinj
Oh, we'd need the pieces to behave like normal textures, so reflection and specularity is essential, and team colour is important.
For what we're using it for (that is, spawning dropships when you build things that drop stuff off then disappear), it may be simpler to write a more simplified lua script for spawning and removing those when needed.
Re: Per-object textures for s3o
Posted: 13 Jun 2008, 09:26
by Pressure Line
reflect and spec are possible, but i dont know how to get assign the it to the texture map...
INCOMPLETE OR INCOMPREHENSIBLE DOCUMENTATION.
Re: Per-object textures for s3o
Posted: 13 Jun 2008, 12:26
by jK
Pressure Line wrote:INCOMPLETE OR INCOMPREHENSIBLE DOCUMENTATION.
3D programming isn't easy, it only gives you some basic functions
and so it is _your_ job to implement stuff like reflections etc.
So it is not an incomplete or incomprehensible documentation, it is:
-> missing knowledge by the reader
Re: Per-object textures for s3o
Posted: 13 Jun 2008, 13:43
by Pressure Line
Code: Select all
gl.Texture
( [ number texNum, ] boolean enable | string name ) -> nil | boolean loaded
current formats:
:${opt}:/LuaUI/images/image.png = filename
#12 = unitDef 12 buildpic
%34:1 = unitDef 34 s3o tex2 (:0->tex1,:1->tex2)
!56 = lua generated texture 56
$units = 3do textureatlas
$shadow = shadowmap
$specular = specular cube map
$reflection = reflection cube map
possible ${opt}'s are:
'n' = nearest
'l' = linear
'a' = aniso
'i' = invert
'g' = greyed
'c' = clamped
'b' = border
't' = tint (don't know how to use it, sorry)
example: ":iac:/LuaUI/images/image.png"
where do the '$reflection' etc go then? its not explained.
edit: and is there a way to convert a string like 'fueltanks' to a number?
Re: Per-object textures for s3o
Posted: 13 Jun 2008, 13:47
by AF
jK wrote:-> missing knowledge by the reader
caused by
jK wrote:incomplete or incomprehensible documentation
Re: Per-object textures for s3o
Posted: 13 Jun 2008, 14:15
by jK
Pressure Line wrote:where do the '$reflection' etc go then? its not explained.
3D programming doesn't work like that!
There is no checkbox "ActivateReflections".
IT IS YOUR JOB TO IMPLEMENT EVERYTHING!
It is only a plain cubemap, it is you part to render it on your model ...
Pressure Line wrote:edit: and is there a way to convert a string like 'fueltanks' to a number?
There are multiple ways, the cleanest way would be
hashes (you have to implement those by your own, spring nor lua doesn't give you a function for that).
AF wrote:jK wrote:-> missing knowledge by the reader
caused by
jK wrote:incomplete or incomprehensible documentation
I thought you were a programmer, then you should know that it doesn't work like that ...
Re: Per-object textures for s3o
Posted: 14 Jun 2008, 16:14
by Pressure Line
jK wrote:Pressure Line wrote:where do the '$reflection' etc go then? its not explained.
3D programming doesn't work like that!
There is no checkbox "ActivateReflections".
It is only a plain cubemap, it is you part to render it on your model ...
I am aware of that. perhaps i got confused by the "current formats" line... which from the way i read it, if i put '$reflection' in there somewhere, could read from a (presumably greyscale) texture, to tell the engine "this part here is reflective, this part not so reflective" (ie exactly like the green channel in an s3o's texture2 does)
Re: Per-object textures for s3o
Posted: 15 Jun 2008, 00:48
by AF
If your in the middle of a town you've never been in and your told to exit the town, it helps enormously if you can see the edge of town ro have documentation e.g. maps and road signs.
As a programmer you should know that APIs need to be documented. Your point goes both ways.
Re: Per-object textures for s3o
Posted: 15 Jun 2008, 01:22
by jK
The Spring Lua API is documented, it is his job to lookup the OpenGL API ...
it won't even help much, coz it is more a technic problem and limits of Spring Lua OpenGL API.
BTW there are only a few code tutorials for 3D programming (most famous is NeHe), so you always have those problems.
And not having code examples means not that it isn't documented, you will find hundreds of papers about 3D programming technics, but they descibe the technic and not the code (similar to all science papers)
And PL, you need to write a shader to get cubemaps working with spring lua opengl (with full opengl you would have different possiblities with combiners). also I already wrote such a glsl shader that copies to 100% the engine unit rendering (except shadows, but those would be easy to implement), it is part of the LUPS cloak fx.
PS: if you want a really bad example for an API wiki
check this
Re: Per-object textures for s3o
Posted: 15 Jun 2008, 01:31
by trepan
which limitations?
Re: Per-object textures for s3o
Posted: 15 Jun 2008, 01:37
by jK
glEnable(GL_TEXTURE_CUBE_MAP_EXT)
Re: Per-object textures for s3o
Posted: 15 Jun 2008, 01:42
by trepan
ah, for the non-shader case; yes, that would be required
you might be able to edit the engine shaders and fill-in
the extra textures though

Re: Per-object textures for s3o
Posted: 15 Jun 2008, 03:04
by AF
hmm, Im glad to hear someone has documented the whole API. Last I heard the phrase "look at the C++ bindings headers" was considered documentation.
Re: Per-object textures for s3o
Posted: 15 Jun 2008, 03:27
by jK
trepan wrote:ah, for the non-shader case; yes, that would be required
you might be able to edit the engine shaders and fill-in
the extra textures though

engine shaders are asm and with lua you can only load glsl

Re: Per-object textures for s3o
Posted: 15 Jun 2008, 03:34
by FLOZi
The Spring Lua API is documented
lol.
hmm, Im glad to hear someone has documented the whole API. Last I heard the phrase "look at the C++ bindings headers" was considered documentation.
Indeed.
Re: Per-object textures for s3o
Posted: 15 Jun 2008, 03:37
by trepan
trepan:
"...edit the engine shaders and fill-in
the extra textures though

"
jK:
engine shaders are asm and with lua you can only load glsl
Didn't think that "loading edited engine shaders with lua" was
implied by "edit the engine shaders". Maybe it's a translation
problem. Anyways, i'm suggesting that the base engine shaders
could be swapped out, and to use lua to provide the extra textures.
The engine shaders are in springcontent.sdz (in SVN). Looking
back at it now, it probably wouldn't work

Re: Per-object textures for s3o
Posted: 15 Jun 2008, 03:47
by jK
he renders those unitpieces with 100% lua (w/o your Spring.UnitRendering interface)
Re: Per-object textures for s3o
Posted: 15 Jun 2008, 03:53
by trepan
Maybe he should start using the UnitRendering interface then
(especially seeing as it's more efficient). And on further review,
my little trick of editing the engine shaders would probably
work, but I'd suggest not bothering with it. Supporting archaic
videos card without frag shaders isn't worth the code

Re: Per-object textures for s3o
Posted: 15 Jun 2008, 03:57
by lurker
Okay, looked a jK's code, and while not horrible complicated, it apparently uses a couple shaders and is incompatible with ATI. This really needs to use the UnitRendering interface if at all feasible.
Assuming I know what the UnitRendering code does. I'm trying my best to read through it.
Edit: To my eyes it looks like you can only set textures per unit, and so have to render parts-all in pure lua, making the whole bunch of code irrelevant. Someone care to explain?
Re: Per-object textures for s3o
Posted: 15 Jun 2008, 04:58
by jK
OpenGL supports more than 5 textures (s3o uses: tex1,tex2,specular,reflection,shadow), so you can load multiple other textures (nvidias support upto 16) and use them only on your pieces instead on the whole unit.
Now you can set a DisplayList per piece, so you can set a special uniform or set a special bit to identify your piece in the shader and switch between the textures.
BTW, that's what trepan meant with modifying the engine shader, you would need to switch between those textures in the shader, therefor it needs to be modified. But with lua itself you can only load glsl shaders, so you have to convert the engine shader to glsl or you modify the asm shader in the .sdz (not possible for a mod afaik).