Digital Paint Discussion Board

Development => General Development => Topic started by: Zorchenhimer on November 21, 2008, 12:42:46 AM

Title: Phong Shading Converter
Post by: Zorchenhimer on November 21, 2008, 12:42:46 AM
I originally was gonna release this alongside Abandon All Hope, but I have a feeling it's gonna be a while before that.  So I decided to release this now.  What it does is 'converts' all the specified textures in a map to use Phong shading.  Readme is included as well as the source.  Hope someone finds a use for this.

phongScript.zip
phongScript_v1.1.zip

phongScript_v1.2.zip (http://www.zorchenhimer.com/pub/phongScript_v1.2.zip)
More bugs fixed

Perl Version
phong_perl.tar.gz (http://www.zorchenhimer.com/pub/phong_perl.tar.gz)


Any comments and suggestions are welcome.
Title: Re: Phong Shading Converter
Post by: ViciouZ on November 21, 2008, 09:40:45 AM
Thanks a ton! Very useful for some of my maps :D

I tried to compile it on linux but ran into a few problems, so I edited main.cpp accordingly and compiled a linux version. An interesting problem was that the pause function didn't work, so I changed it to use getchar(); instead and it ran fine. Wierd. Also, the linux version is only 16.7kb, considerably smaller than the windows EXE.

Attached is the edited main.cpp and the compiled linux version.

Also, whats with it creating a huge temp file full of the characters "10" repeated for ages, then not clearing up after itself?
Title: Re: Phong Shading Converter
Post by: Zorchenhimer on November 21, 2008, 10:55:59 AM
Huge temp file?  It shouldn't be.  Is that on my version, or your Linux version?  It should be writing directly to the new file.

And I didn't think that the pause() function would work as is on Linux.  Read a bunch of issues with that.  But it was better than using system("pause").  :P
Title: Re: Phong Shading Converter
Post by: KnacK on November 21, 2008, 11:14:23 AM
(http://uts.cc.utexas.edu/~ifex534/phong.gif)

 I found this rather relevent for this discussion.
Title: Re: Phong Shading Converter
Post by: ViciouZ on November 21, 2008, 11:15:12 AM
Pause function does in fact work anyway, but it doesn't work if you enter the wrong map name, which also results in the huge temp files. You may want to fix that.
Title: Re: Phong Shading Converter
Post by: Prime24 on November 21, 2008, 11:24:05 AM
i agree with knack, this image helped me understand the conversation in ways no one can understand =]
Title: Re: Phong Shading Converter
Post by: Zorchenhimer on November 21, 2008, 11:52:07 AM
Haha.  I haven't seen that show in a looooooong time.

Anyway, I uploaded an updated version.  Fixed a few bugs.  Theres still a few more, but I'll fix them later.
Title: Re: Phong Shading Converter
Post by: Zorchenhimer on November 24, 2008, 08:15:04 PM
More bugs fixed.  Updated first post.
Title: Re: Phong Shading Converter
Post by: stephen schultz on November 24, 2008, 09:38:52 PM
looka awsome zorch,.you freaken rock
Title: Re: Phong Shading Converter
Post by: Zorchenhimer on December 23, 2008, 05:38:39 AM
So, I decided to learn Perl over the weekend.  After I did, I tried to rewrite this program in Perl.  I shaved off a little under one hundred lines from the source.  :D
I'll post it here when I get around to uploading it.

Also, ViciouZ.  This script fixes the issue the C++ version was having with your map.  If there aren't enough sets of digits, it adds them (hopefully).



For those of you who don't know what this script does, this should help:

Before
(http://pics.zorchenhimer.com/phong-before.jpg)

After
(http://pics.zorchenhimer.com/phong-after.jpg)
Title: Re: Phong Shading Converter
Post by: Rick on December 23, 2008, 05:11:12 PM
oh wow, I was about to come in this thread and ask what it actually does...But that looks sweet.
Title: Re: Phong Shading Converter
Post by: vague312 on December 25, 2008, 11:26:31 PM
nice!
Title: Re: Phong Shading Converter
Post by: Zorchenhimer on January 02, 2009, 11:34:25 PM
Perl Version
phong_perl.tar.gz (http://www.zorchenhimer.com/pub/phong_perl.tar.gz)

Bump'd.

Feel free to point out any issues.  :P