Per-object textures for s3o
Moderator: Moderators
-
- Imperial Winter Developer
- Posts: 3742
- Joined: 24 Aug 2004, 08:59
Re: Per-object textures for s3o
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.
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.
- Pressure Line
- Posts: 2283
- Joined: 21 May 2007, 02:09
Re: Per-object textures for s3o
reflect and spec are possible, but i dont know how to get assign the it to the texture map...
INCOMPLETE OR INCOMPREHENSIBLE DOCUMENTATION.
INCOMPLETE OR INCOMPREHENSIBLE DOCUMENTATION.
Re: Per-object textures for s3o
3D programming isn't easy, it only gives you some basic functionsPressure Line wrote:INCOMPLETE OR INCOMPREHENSIBLE DOCUMENTATION.
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
- Pressure Line
- Posts: 2283
- Joined: 21 May 2007, 02:09
Re: Per-object textures for s3o
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"
edit: and is there a way to convert a string like 'fueltanks' to a number?
Re: Per-object textures for s3o
caused byjK wrote:-> missing knowledge by the reader
jK wrote:incomplete or incomprehensible documentation
Re: Per-object textures for s3o
3D programming doesn't work like that!Pressure Line wrote:where do the '$reflection' etc go then? its not explained.
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 ...
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).Pressure Line wrote:edit: and is there a way to convert a string like 'fueltanks' to a number?
I thought you were a programmer, then you should know that it doesn't work like that ...AF wrote:caused byjK wrote:-> missing knowledge by the readerjK wrote:incomplete or incomprehensible documentation
- Pressure Line
- Posts: 2283
- Joined: 21 May 2007, 02:09
Re: Per-object textures for s3o
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)jK wrote:3D programming doesn't work like that!Pressure Line wrote:where do the '$reflection' etc go then? its not explained.
There is no checkbox "ActivateReflections".
It is only a plain cubemap, it is you part to render it on your model ...
Re: Per-object textures for s3o
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.
As a programmer you should know that APIs need to be documented. Your point goes both ways.
Re: Per-object textures for s3o
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
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
Last edited by jK on 15 Jun 2008, 01:39, edited 1 time in total.
Re: Per-object textures for s3o
which limitations?
Re: Per-object textures for s3o
glEnable(GL_TEXTURE_CUBE_MAP_EXT)
Re: Per-object textures for s3o
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
you might be able to edit the engine shaders and fill-in
the extra textures though

Re: Per-object textures for s3o
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
engine shaders are asm and with lua you can only load glsltrepan 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

Re: Per-object textures for s3o
lol.The Spring Lua API is documented
Indeed.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
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
"...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
he renders those unitpieces with 100% lua (w/o your Spring.UnitRendering interface)
Re: Per-object textures for s3o
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
(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
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?
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
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).
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).