|
|
pixel_to_bmap for separate channels
#343256
10/04/10 19:44
10/04/10 19:44
|
Joined: Sep 2003
Posts: 5,900 Bielefeld, Germany
Pappenheimer
OP
Senior Expert
|
OP
Senior Expert
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
|
Maybe, that I am simply too dump to see this in the manual: First: I want to write into an alpha channel of a bitmap only. Can I change a channel of a bitmap without changing the others as well? Example: We've got the terrain shader where each skin contains a texture as rgb and a blendmap in the alpha channel. When I want to influence the appearance of the terrain, it makes sense to write into the alpha of one of its bitmaps, because this influences the blending/placing of the texture, but it makes no sense alter anything of the texture in the rgb channels, because it is repeated over the terrain. Second: I want to use the terrain shader for a model, because I want to build steep slopes and caves AND blend the textures smoothly. Is it possible to change it or to add a shader that does the same sort of blending with models as well?
BTW: Mixing a pixel vector with the given pixels of the bitmap to make the change more fluent were nice, as well.
Last edited by Pappenheimer; 10/04/10 20:19. Reason: additional request
|
|
|
Re: pixel_to_bmap for separate channels
[Re: wdlmaster]
#343270
10/04/10 21:30
10/04/10 21:30
|
Joined: Sep 2003
Posts: 5,900 Bielefeld, Germany
Pappenheimer
OP
Senior Expert
|
OP
Senior Expert
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
|
1) My guess is that changing a single channel of a pixel is faster than the way that you described. And it is less cumbersome. 2) Just created a stripped down version: #include <acknex.h> // include these predefined, needed files in our project #include <default.c> #include <compat.h> #include <mtlFX.c> #include <mtlView.c>
#include <strio.c>
#define PRAGMA_ZERO
#define PRAGMA_PATH "terrains";
function main() { level_load(NULL); detail_size = 12; // ent_create("terrain.hmp", nullvector,fx_terraintex);//this gets tiled properly ent_create("terrain.mdl", nullvector,fx_terraintex);//...this isn't tiled at all }
|
|
|
Re: pixel_to_bmap for separate channels
[Re: Pappenheimer]
#343411
10/06/10 03:57
10/06/10 03:57
|
Joined: Mar 2002
Posts: 1,774 Magdeburg
FlorianP
Serious User
|
Serious User
Joined: Mar 2002
Posts: 1,774
Magdeburg
|
For the 8888 format it would look kinda like this
bmap_lock(bmap, 0);
char* bits = (char*)bmap->finalbits;
int x, y;
bits[x * 4 + y * bmap->finalwidth * 4 + 3] = newAlpha;
bmap_unlock(bmap);
I <3 LINQ
|
|
|
|