GPWiki.org
GPWiki.org
It is currently Thu May 23, 2013 9:45 pm

All times are UTC




Post new topic Reply to topic  [ 16 posts ] 
Author Message
PostPosted: Sat Nov 07, 2009 10:52 am 
Level 1 Cleric

Joined: Sat Nov 07, 2009 10:47 am
Posts: 14
I'm making an RPG where you can customize your character. Hair, eyes and etc... and i want a "Colorize mode" :) Can anyone explain me how do i use the palette plz?

I don't speak english, but this is the only good community i've found that supports DX7 too :)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 07, 2009 11:09 am 
Corpse Bride
User avatar

Joined: Tue Jul 01, 2008 11:44 pm
Posts: 2217
Location: England
If I were doing this, I wouldn't use palettes. I would do one of two things:

1. If my graphics were cell shaded, I'd do a pixel by pixel recolouring of those cell colours, replacing an old RGB value with the desired RGB value.

2. If my graphics were not cell shaded, I'd apply a lighting effect across the image such as subtracting from or multiplying the RGB of each pixel by the same figure.

eg, (red,grn,blu) --> (mred*red , mgrn*grn , mblu*blu)
or
(red,grn,blu) --> (-mred+red , -mgrn+grn , -mblu+blu)


However, you say you're using DX7. I believe that provides some lighting effects, which you could use to change the appearance of graphics. But I don't know much about DX.

_________________
I ain't pushing no moon buttons.


Last edited by Jasmine on Sat Nov 07, 2009 11:13 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 07, 2009 11:11 am 
Level 1 Cleric

Joined: Sat Nov 07, 2009 10:47 am
Posts: 14
Jasmine wrote:
If I were doing this, I wouldn't use palettes. I would do one of two things:

1. If my graphics were cell shaded, I'd do a pixel by pixel recolouring of those cell colours, replacing an old RGB value with the desired RGB value.

2. If my graphics were not cell shaded, I'd apply a lighting effect across the image such as subtracting from or multiplying the RGB of each pixel by the same figure.

eg, (red,grn,blu) --> (mred*red , mgrn*grn , mblu*blu)

or

(red,grn,blu) --> (-mred+red , -mgrn+grn , -mblu+blu)


It's cell shaded, but the surface is very large, i can't do this for every player in the game. :/


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 07, 2009 11:19 am 
Corpse Bride
User avatar

Joined: Tue Jul 01, 2008 11:44 pm
Posts: 2217
Location: England
okay. It doesn't have to be recoloured every time those graphics are redrawn. You have the option of preparing the recoloured graphics as a character is created. Would that be quick enough? Or would it sap too much memory?

_________________
I ain't pushing no moon buttons.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 07, 2009 11:21 am 
Level 1 Cleric

Joined: Sat Nov 07, 2009 10:47 am
Posts: 14
Too much memory. If i do this, i have to save the surface in the memory, but the surface image is 256*8192, if i have 3 pg i have to save this 3 times and recolour it 3 times :/


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 07, 2009 11:23 am 
Corpse Bride
User avatar

Joined: Tue Jul 01, 2008 11:44 pm
Posts: 2217
Location: England
then you need to use palettes :P

(I don't know how)

_________________
I ain't pushing no moon buttons.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 07, 2009 11:31 am 
Level 1 Cleric

Joined: Sat Nov 07, 2009 10:47 am
Posts: 14
Yes :) But... how i use it?? :) Do you know any tutorials??


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 07, 2009 11:36 am 
Corpse Bride
User avatar

Joined: Tue Jul 01, 2008 11:44 pm
Posts: 2217
Location: England
http://www.gamedev.net/reference/progra ... pgenesis5/

http://www.gamedev.net/reference/articl ... cle608.asp

That's all I can find.

_________________
I ain't pushing no moon buttons.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 07, 2009 6:03 pm 
Level 1 Cleric

Joined: Sat Nov 07, 2009 10:47 am
Posts: 14
Nothing... :( I think palette-system is impossibile on directx7 :(


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 07, 2009 6:52 pm 
Corpse Bride
User avatar

Joined: Tue Jul 01, 2008 11:44 pm
Posts: 2217
Location: England
If you're running in 256 colour mode, directdraw does use a palette, but you may not be able to draw with palette mapping. Directdraw was left in an incomplete state when 3d took over the world. :(

So...

How many characters are going to be on screen at once? Because you could reserve some of the palette for hair/eye colours, and have just two or three colour variations loaded into video memory.

You would adjust the global palette to change the colour of these features depending on what characters were on screen.

_________________
I ain't pushing no moon buttons.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 07, 2009 8:56 pm 
Level 1 Cleric

Joined: Sat Nov 07, 2009 10:47 am
Posts: 14
On www.directx4vb.vbgamer.com it works!!
Look: http://directx4vb.vbgamer.com/DirectX4V ... lettes.asp

i follow the code, and i do it on my game and it doesn't work .-.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 07, 2009 9:12 pm 
Corpse Bride
User avatar

Joined: Tue Jul 01, 2008 11:44 pm
Posts: 2217
Location: England
What do you get when you try it?

If it's applying a palette to a surface, then what is being copied from that surface to your screen buffer ?

Is it full rgb or does it remain as a paletted bitmap. Because if it's paletted then won't the palette of the screen buffer will be applied to it? overriding whatever palette you applied intermediately?

_________________
I ain't pushing no moon buttons.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 07, 2009 9:16 pm 
Level 1 Cleric

Joined: Sat Nov 07, 2009 10:47 am
Posts: 14
Error Number : 8876023C ( -2005532100 )
Error Code : DDERR_NOPALETTEATTACHED
Description : No palette object attached to this surface.

I get this error and my game closes..


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 07, 2009 9:25 pm 
Corpse Bride
User avatar

Joined: Tue Jul 01, 2008 11:44 pm
Posts: 2217
Location: England
I can only make guesses. Maybe this?

-- Surfaces must be created before palettes can be applied to them.

-- Palettes must be created before they can be attached to a surface.

Try disabling certain lines starting from the bottom. Narrow it down to one which causes this error.

_________________
I ain't pushing no moon buttons.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 07, 2009 9:31 pm 
Level 1 Cleric

Joined: Sat Nov 07, 2009 10:47 am
Posts: 14
Code:
Dim Pal(0 To 255) As PALETTEENTRY
Dim dPal As DirectDrawPalette
Dim d As DDSURFACEDESC2
   
    d.lFlags = DDSD_CAPS
    d.ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN Or DDSCAPS_SYSTEMMEMORY
    d.ddpfPixelFormat.lFlags = DDPF_PALETTEINDEXEDTO8
    Set DD_PkmnIcons = dd.CreateSurfaceFromFile(App.Path & "\GFX\PkmnGFX\PkmnIcons.bmp", d)
   

    Set DDPalette = dd.CreatePalette(DDPCAPS_8BIT Or DDPCAPS_ALLOW256, Pal())
    DD_PkmnIcons.SetPalette dPal


This is my code :) if everything it's allright, i must see the surface colored in black..


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 08, 2009 11:18 am 
Level 1 Cleric

Joined: Sat Nov 07, 2009 10:47 am
Posts: 14
Ok, i've found...
To let the palette works you need to set the gamescreen to Fullscreen and 8-bit mode. Or it doesn't work... :(


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group