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.

DarkBASIC Professional Discussion / Help with code convert for NORMALIZATOR filter.

Author
Message
OldPMan
TGC Store Seller
10
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 14th May 2018 20:32 Edited at: 20th Aug 2018 09:08
Hello!
Can anyone help with the conversion of code to DBPRO code?
Here is the link to the article - http://stannum.co.il/blog/1/reconstructing-a-height-map-from-a-normal-map
Unfortunately, I do not quite understand the syntax of this code. I would like to use this method of reconstructing the height map from normalmap in NORMALIZATOR.

By the way, here are a few keys STEAM version NORMALIZATOR - http://store.steampowered.com/app/703300/

If you took one of the keys, let us know that it is activated.

5VN8G-X3DYM-4FWCV - activated
A9LVD-4R3RC-7H8MP - activated
FEYB4-R224N-38BAW - activated
RYXHZ-E7ZYF-MPCRC - activated
JK9CX-W8QW2-XB8IQ - activated
V40TA-VALHV-2N5V3 - activated
EDKFC-BYTN7-XXK57
7MDH0-GDLWQ-MWLJ0
0XGNY-Y8F9V-8VWVG
XFYZT-5TCY7-LANA0
ATZ25-M8KZ6-MGTAA
QYR6L-GR4QZ-PZB7W
IFV57-8IA8K-9H4VH
KXG5D-4J5P7-EBZQK
LQJN0-BLKAA-3XPYE
C75K4-TRYNE-CEG95
T0ETP-HZTIC-QFPMN
WTHEI-PTXDF-EW7VW
G0KNG-RAWPV-M5KCY
V743E-LYJCC-6VEKX - activated
CWP2A-A9ZAE-7CLLA
7G9V4-GFYEE-FK4M7 - activated
EX3HL-WR5F3-CTPIE - activated
3G78P-LQDIA-FAMVP - activated
YFLGG-L9ZWB-5ZFZ6 - activated
The secret to creativity is knowing how to hide your sources.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 15th May 2018 08:43
ah yes, I most likely can. I'll take a look after work. Will be interesting as I'm working on my next incarnation of Heightmap 2 GameGuru at the moment.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
OldPMan
TGC Store Seller
10
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 15th May 2018 09:24
Wow. Hi, Bored of the Rings , It would be cool!
The secret to creativity is knowing how to hide your sources.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 16th May 2018 05:12
The code example uses a C subroutine library FFTW. Are you looking to use this library in DBPro?
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
OldPMan
TGC Store Seller
10
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 16th May 2018 05:45
If this is possible and is mandatory for the code example , then yes.
The secret to creativity is knowing how to hide your sources.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 16th May 2018 06:49 Edited at: 16th May 2018 07:40
yes, it looks like you will definitely need to use the FFTW dll library. Whether that will work in DBPRo is another question.

[update-the good news is the Dlls load into DBPro ok-if I get time after work I'll carry on investigating the dll's and see if it's possible to use any of the functions. ]
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
OldPMan
TGC Store Seller
10
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 16th May 2018 07:54
I understood you. Thank you very much for trying.
The secret to creativity is knowing how to hide your sources.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 16th May 2018 08:59
Still looking into it. One of the functions doesn't exist in any of the 3 dlls according to dbpro command call exist ... will see what I can do but not sure it will work....
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 16th May 2018 21:33 Edited at: 16th May 2018 21:55
ok I had another look at the functions in the dlls and the function that I thought didn't exist, does exist after all. I'll keep stabbing away with this, hopefully have something to show in next few days.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
OldPMan
TGC Store Seller
10
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 16th May 2018 21:58
It's a good news. Thank you for your time you spend to deal with this. I hope that you can also use this code.
The secret to creativity is knowing how to hide your sources.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 17th May 2018 23:28 Edited at: 17th May 2018 23:31
looks like there is already a FFTW wrapper for DBPro, please find link here:

https://forum.thegamecreators.com/thread/193909

This will definitely help.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
OldPMan
TGC Store Seller
10
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 18th May 2018 00:06
I'm ready to argue that I've already seen this library, I do not know why I did not remember about it. It really can help.
The secret to creativity is knowing how to hide your sources.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 18th May 2018 00:22
yes I am looking forward to experimenting with this wrapper and seeing if I can put it to good use for my heightmap app.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Mage
11
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 3rd Jun 2018 01:13 Edited at: 4th Jun 2018 05:33
[Edit] Asked Bored an unrelated question.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 3rd Jun 2018 06:51 Edited at: 5th Jun 2018 07:02
[edit-unrelated to this post]
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
OldPMan
TGC Store Seller
10
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 6th Jun 2018 23:32
Hello!
Did anyone activate the keys from Normalizator from the first post?
I ask because I did not notice the activations. You can take these keys for free.

@Bored ,did you have time to look at the code?
By the way, I wrote the code that extracts AOmap from normalmap (it's not perfect but it works). Let me know if you're interested.
I want to add three new functions to Normalizer: "LightMagick", "MiddleMagick" and "HiMagick". These functions will work as presets for one image using preset filter sets for all channels.
The secret to creativity is knowing how to hide your sources.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 7th Jun 2018 06:52
@OldPman, I had a look at the code, and the example code that came with the FFTW plugin but not got far due to other committments. I'll see if I can find some time to carry on.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
revenant chaos
Valued Member
11
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 8th Jun 2018 16:01
Hi OldPMan,
I just used the first activation key (5VN8G-X3DYM-4FWCV). Thanks man, this is going to be very useful.
OldPMan
TGC Store Seller
10
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 8th Jun 2018 23:23
Hi, revenant chaos.
Thank you for reporting the activation of the key.
I hope to see your best screenshot.
The secret to creativity is knowing how to hide your sources.
Derek Darkly
7
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 10th Jun 2018 00:45
Who else is pulling for this thread? Even just because OldPMan has a cool avatar? #MeToo
Send your parents to noisy sprite demo hell... enter the D-Zone
seppgirty
FPSC Reloaded Backer
9
Years of Service
User Offline
Joined: 3rd Jul 2009
Location: pittsburgh, pa.
Posted: 10th Jun 2018 21:18
I am.
gamer, lover, filmmaker
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 11th Jun 2018 06:09
@OldPman- am looking at the code again today. If I get good results, will PM/email you the code.
BW
BOTR
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
OldPMan
TGC Store Seller
10
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 11th Jun 2018 13:42
@BOTR , Hey. I hope you get.
The secret to creativity is knowing how to hide your sources.
G4M3R13
User Offline
Joined: 25th Jul 2018
Playing:
Posted: 25th Jul 2018 05:51
hey Thanks !

i activated this one on steam>>

V743E-LYJCC-6VEKX
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 29th Jul 2018 17:54 Edited at: 29th Jul 2018 17:54
revisiting this again while I'm still working with images etc. Didn't get very far before and wasn't producing anything great. I probably need to understand the FFTW plugin more and how it works. Once I get any good results worth posting, I'll post the code and example pic(s) and also see how well it works with my HeightMap to GameGuru app.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 1st Aug 2018 09:36 Edited at: 1st Aug 2018 17:07
started a clean program and reading up a little on the FFTW. dumped out a memblock of the normal image so far along with RGBA DWORD color values. All this has to be converted to heightmap float values using FFTW. The example FFTW that came with the DLL wrapper isn't correct for what we want looking at the output image. Will see how this all goes, there's more to it than I first thought looking at the reference material on google etc....

At the moment, my Heightmap to GameGuru converts a Normal image (or any HM image) to Heightmap using Blitzterrain and seems to come out well. See pics 1 and 2 below:
It will be a good comparison when I get the FFTW code working correctly for this project.

so for this, I will be using pointers to array elements like the C code.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 2nd Aug 2018 12:13
so far implemented/converted code doesn't cause any premature crashes in DBPro, so good start. no pics yet, but I want to get this right before uploading any images of what's been achieved so far.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
OldPMan
TGC Store Seller
10
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 4th Aug 2018 17:22
Hey Bored of the Rings.
Wow. For a long time I did not go here.
Really at you it has turned out?
The secret to creativity is knowing how to hide your sources.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 4th Aug 2018 19:10
@OldPMan-Yes, it's been a while. I'm almost there with this, as soon as I'm happy with the results/code I'll post here.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 5th Aug 2018 21:12 Edited at: 5th Aug 2018 21:25
so it looks so far to be pretty successful after following the original FFTW code, although the real test will be creating the image (2 minute job), from the RESULT memblock. all going well, will post pic soon as.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 6th Aug 2018 00:25
Hmmm, the fftw code produces 8 bit image height map and dbpro only really supports 32 bit. Having said that I did manage to get the image saved out as a png file but looked like a fingerprint. And the Result array changes every time. Need to check code and see what else I can do to get a good result.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 7th Aug 2018 11:28
ok, so have started rewriting the code as the first attempt was a bit of a disaster, although on the positive side I managed to create a 8 and 32 bit images of the heightmap. Was completey wrong the of course. Think I've spotted my mistakes so this rewrite should hopefully produce as better result of the normal image.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 8th Aug 2018 15:25
ok, so program has had quite a lot of fixes applied due the way DBPro handles memblocks, memblock ptrs and arrays and array ptrs (using Matrix1Utils). now after some thorough testing, all is going well and hoping to produce a good heightmap image soon. Luckily as a statistical programmer/scientist/analyst, I have been able to apply my skills/experience to using FFTW calculations. Got quite complex with DBPro, so will also quickly use the example program in C+ and expand on it.
Piccy soon hopefully.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
OldPMan
TGC Store Seller
10
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 17th Aug 2018 09:42
Greetings.
I again did not come here for a long time. (I was modeling) How are you doing. I hope you managed to make a map of heights. It spends not too much of your time?
The secret to creativity is knowing how to hide your sources.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 17th Aug 2018 10:42
@OldPMan-How are you doing? Yes, I've not worked too much on this at the moment as I've been on holiday. I've rewritten the code but it's now producing coloured lines whereas before I was getting fingerprint like images. I'm not sure the example code is correct in places and also whether the FFTW plugin really works with this example or at all. I'm going to implement in C+ and see if I get better results. Will keep perservering.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
OldPMan
TGC Store Seller
10
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 17th Aug 2018 18:14
@Bored of the Rings . I'm fine. I hope you had a good holiday with children
Maybe you could give me DBPro code, maybe I'll try something too.
The secret to creativity is knowing how to hide your sources.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 18th Aug 2018 11:49 Edited at: 18th Aug 2018 11:49
@OldPman-Played around with the code again and fixed a couple of things, getting this pic below (rather yellow looking). I'm sure I will get there in the end.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
geistschatten
6
Years of Service
User Offline
Joined: 10th Apr 2012
Location:
Posted: 20th Aug 2018 07:58
Looking forward to using the new version of Normalizer!

Thank you OldPMan for offering those keys, I activated EX3HL-WR5F3-CTPIE on Steam.
OldPMan
TGC Store Seller
10
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 20th Aug 2018 09:10
@geistschatten, thanks for the activation information. I hope you enjoy the new version.
The secret to creativity is knowing how to hide your sources.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 20th Aug 2018 15:29 Edited at: 20th Aug 2018 15:29
@OldPman-I've adopted a slightly different approach based on code GIMP plugin uses which convert normalmaps to heightmaps. Seems to be working well so far. No image yet as the code uses macro code which I'm having to translate to DBPRO code using functions. The actual Gimp plugin works really well and generates the original heightmap accurately. Might add pics here later, will see how the progression errrrr ..... well.... progresses
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 22nd Aug 2018 07:35 Edited at: 22nd Aug 2018 07:36
@OldPMan-the new code seems to be working. I'm still updating the code to fix something I missed, but here is a pic (not at all complete). The pic shows the initial process of 'Pokeing' each pixel starting from top left or bottom right. I'll add more pics as it progresses. so hopefully I will PM you the code once it's done, i had to use my maths/stats experience to convert the C code (i.e. Gimp's Normalmap to Heightmap code). I've ditched the FFTW code for now as I'm not sure how correct it is and also if it really works with the FFTW plugin correctly.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
OldPMan
TGC Store Seller
10
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 23rd Aug 2018 09:34
@Bored of the Rings, wow ,and this will work with DBPro? Great!
The secret to creativity is knowing how to hide your sources.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 23rd Aug 2018 12:53 Edited at: 23rd Aug 2018 12:55
@OldPman, yes the code works with DBPRo, it still needs a little more work but getting there. There are a few adjustments needed as the C code logic needs adapting to work wth DBPRO and getting the pixels to display correctly is a little tricky but getting better. As the formula is quite complex I'm having to double check DBPro code logic / formula is correct, a few issues somewhere but here is another pic, showing the various grey scaled pixels but not quite filling up the whole 256x256 image area at the moment as the code that plots the pixels is overwriting with black pixels in places. So once I've figured out where I've gone wrong we should have a full image of a heightmap. Very tricky this, but am enjoying the challenge. I've found some new techniques with image memblock also so that will help with this. Also, the program allows you to control the contrast as it does in GIMP. Once all working, I'll add more options where applicable.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
OldPMan
TGC Store Seller
10
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 23rd Aug 2018 14:26
@Bored of the Rings, this is quite promising. I really hope that you reach the ideal!
The secret to creativity is knowing how to hide your sources.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 23rd Aug 2018 14:40
@OldPman-thanks, I also need this program for my heightmap to Gameguru app . Obviously, at the moment, I'm working on this where time allows., but hoping to finish this soon.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Derek Darkly
7
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 24th Aug 2018 01:41

OldPman!! OldPman!! OldPman!!

I have no idea what this thread is about. OldPman has a cool avatar, though!
Send your parents to noisy sprite demo hell... enter the D-Zone
OldPMan
TGC Store Seller
10
Years of Service
User Offline
Joined: 10th Aug 2008
Location:
Posted: 26th Aug 2018 20:17
Hi Derek Darkly !
Yes, old avatar
The secret to creativity is knowing how to hide your sources.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 29th Aug 2018 09:18 Edited at: 29th Aug 2018 09:32
@OldPman-here is a test.png of the generated heightmap from the DBPro code converted from C code. Not looking like the original Normal map or the heightmap that was generated from the Gimp plugin. So rewriting parts of the DBPro code and adding more debug code to see why it's not coming out correctly. 1st pic is the original Normal map , the 2nd pic is the heightmap recreated using the Gimp plugin and the 3rd pic is the DBPro produced image that is supposed to look like the 2nd pic. Will figure it out.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 30th Aug 2018 17:14
@OldPman-ok, so the new revised code seems to work so far (still got 3 more steps to add in ie. top right to bottom left etc.... all being well will post you the code and put image here.... watch this space
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 30th Aug 2018 23:20 Edited at: 30th Aug 2018 23:22
@OldPman-Phew, almost there. Here is the latest pic showing the recreated heightmap from the sample normal map above. I've been playing around with various internal values and contrast so may look different at the moment. This has been a tough but worth it challenge. To re-iterate, the DBPro code is based on the original C code from the Gimp normalmap plugin. I'll send you the code once it's been optimized/tidied etc. Let me know if you still require the code.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments

Login to post a reply

Server time is: 2018-10-17 11:39:48
Your offset time is: 2018-10-17 11:39:48