Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
A r e n a s
18
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 2nd Jun 2010 13:05
Hey everyone. I was wondering if it is possible to darken an image which is gievn to the program. I am using a variety of file extensions, such as '.tga' and '.dds'. I was wondering if it were possible to either:

1) Darken an image using db pro then save it back into its original format with a slightly different name.

2) Use an editor to darken the image (and possibly apply a normal map to it in a second interface with the image).

If anyone can get back to me with idea on these theories that would be great.

Thanks,

Arenas

Serial Velocity
17
Years of Service
User Offline
Joined: 24th Aug 2008
Location:
Posted: 2nd Jun 2010 13:36 Edited at: 2nd Jun 2010 13:36
You can convert your image to a memblock, then edit the memblock data. Do a search for "memblock images" and you should be able to find something.

To darken an image you would probably divide the colour values by the percentage you want it to result as. So if you want it 50% the original brightness it would be like:



GDKUtilities, a utility library for DarkGDK, avaliable here
A r e n a s
18
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 2nd Jun 2010 14:05
Ive had a bit of a mess about with the memblocks but I cant get anything to work :/ Below is the code that I have used to create the memblock image:



I just get a blue screen :S When I dont delete the image it all works fine... Could anyone tell me what I am doing wrong?

@Serial Velocity

How would i implement changing colour? I cant find any commands which allow me to modify parts of the memblock such as colour.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 2nd Jun 2010 15:01 Edited at: 2nd Jun 2010 15:01
Surely it would be easier to just use GIMP or another image manipulation program? Unless you need to do it as part of your game what's the point (other than an interesting problem)?

However, another possible solution might be to make a black image and blend it with your existing image using this snippet:
http://forum.thegamecreators.com/?m=forum_view&t=32327&b=6



A r e n a s
18
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 2nd Jun 2010 15:21
The program I am making is for the FPSC community. In FPSC, you could have over 100 segments, each with two textures, and then you need to apply a bump map and specular map to them all I have managed to cut down a hell of a load of work with creating the FPS and various other files, by having my program do all the work for you. What you still have to do is to make a bump map and specular map (darkened version of the texture) for every one of those 200 image textures.

If anyone has any idea on how i can acomplish any of these final two tasks i'll be willing to try it.

@baxslash

The code snippet seems to be full of errors :S

Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 2nd Jun 2010 15:43
Hi Arenas,

As far as I know, DDS files cannot be converted to memblocks. I would suggest using set sprite diffuse Sprite, Red, Green, Blue. Set Red, Green, Blue to the same value ranging from 0-255 and it should give the same effect as darken.

Then use paste sprite and get image to grab the new one.

Cheers!
Sven B

A r e n a s
18
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 2nd Jun 2010 19:45 Edited at: 2nd Jun 2010 20:07
@Sven B

its worked great thanks The image has gone darker and everything Its so simple. The only problem Im now having is that when i get the image, its getting a black screen :/ And the image which the computer gets is 4MB :/

Does anyone know how to limit the size of the image and fix the black image error?

EDIT

The image is not black, its transparent.

EDIT 2

Heres the code im using to help anyone with the time to help me



If I solve the problem I'll let you know

EDIT 3

I got it solved For some reason get image doesnt like sprites. It works fine if I use a bitmap though So its all good. Does anyone have any idea on how to do the normal maps?

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 4th Jun 2010 16:22
Hi all. As it has been mentioned, you can use an external program to get that.If you want just make it with darkbasic, here is an example.




Cheers.

I'm not a grumpy grandpa
A r e n a s
18
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 4th Jun 2010 19:42
This is the code which I settled with. It displays the image as a bitmap and fades the bitmap into the black background. This darkens the image as necessary.



I'll try your idea all the same chafari, just because the current method pauses for a few seconds while it process each image.

KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 4th Jun 2010 19:56 Edited at: 4th Jun 2010 19:59
If you have IanM's Matrix1Utils, then you have his CLS and RGB commands that let's you set the ALPHA and clear the screen with that color and alpha value.

Set bitmap format 21

- Create a bitmap
- CLS RGB(alpha, red, green, blue) Set the alpha to the amount of darkening you want, and the other values to 0
- Grab this image using a texture flag value of 3
- Paste your image you want darkened
- Paste the image you created over it, which will darken it based on your alpha setting
- Grab the result using the texture flag of 3

=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 5th Jun 2010 16:55
I would just paste a black sprite with the required alpha transparency over the image.

KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 5th Jun 2010 17:31
That works too.

A r e n a s
18
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 5th Jun 2010 17:57
Which was do you you guys think will be the faster way of doing things?

KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 5th Jun 2010 18:09
Either way you're using the GET IMAGE command, which is relatively slow, so it really doesn't make a lot of difference. The other thing is, if this is a tool and not something that's happening on the fly during intense gameplay, then speed really isn't much of an issue.

=PRoF=
23
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 5th Jun 2010 18:21
Does the D3D plug in allow you to draw alpha'd boxes to screen in a single command? I have a feeling it does, but am on the wrong PC to look atm.

James H
19
Years of Service
User Offline
Joined: 21st Apr 2007
Location: St Helens
Posted: 6th Jun 2010 02:36
If you aren`t too bothered about speed you could always load the image as a bitmap, then fade it;
A r e n a s
18
Years of Service
User Offline
Joined: 9th Jun 2008
Location:
Posted: 6th Jun 2010 13:09
James, thats what I have already used

Login to post a reply

Server time is: 2026-07-25 16:19:17
Your offset time is: 2026-07-25 16:19:17