Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: 1 2 [3] 4 5
  Print  
Author Topic: Zak's HLSL Sky Demo in VB.NET (Download)  (Read 12836 times)
Taneas
Customers
Community Member
*****
Posts: 159


« Reply #40 on: May 26, 2006, 02:50:17 AM »

Its weird,

I even deleted your frm main after copying the Load / Unload events out of it, and made my own form, and it still errors...
Logged

- Working as Intended -
- FTW Studios Lead Developer -
- www.ftw-studios.com -
JohnB
Customers
Community Member
*****
Posts: 183


« Reply #41 on: May 26, 2006, 02:53:58 AM »

Actually, I just checked the file at cox and instead of uploading the new one it reposted the old one. (I seem  to be having one of those nights.)  To get the file up to them I had to change it's name.  Try this link instead:

http://members.cox.net/squadracorse/ZakSkyVB_V3.rar

Thanks for messing with this by the way - I'm sorry it's being a pain but really appreciate you taking the time to help me make sure it works.

John B.


[EDIT] Updated the link to the latest version of the .rar file.
Logged
JohnB
Customers
Community Member
*****
Posts: 183


« Reply #42 on: May 26, 2006, 03:13:52 AM »

Not sure why it builds a seperage designer file -  I never really thought about it until you asked.  I'm using Visual Studio 2005 Professional to write it. Maybe it's a setting somewhere in the preferences or something.  It's afeter 3 AM here though and I gotta get some sleep before work tomorrow.  I'll check back and see if that last build worked any better in the morning.

Thanks again,

John B.
Logged
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #43 on: May 26, 2006, 06:47:19 AM »

The code works over here, after changing the MTV3D65 reference and adding the beta info where needed. It looks great, good work!
Although there is one thing that looks wierd... looks like the colors are not scaled properly, like the gamma or power coefficients are not calculated right. The day sky colors are way too pastel and bright at turbidity=2.25 (same as the c# version's default)...
I'll have a look into this when I come back from work today.
Logged

klined
Customers
Community Member
*****
Posts: 94


« Reply #44 on: May 26, 2006, 09:37:38 AM »

I think it is because the Adobe thing, try to download adobe reader last version.
Logged

--
Andrei Daldegan
JohnB
Customers
Community Member
*****
Posts: 183


« Reply #45 on: May 26, 2006, 10:40:28 AM »

Thanks for checking it out Zaknafein.  I was getting kind of worried there for a while.  I don't know what would be throwing the colors off.  I'll try to compare my VB code to your C# to see if I can spot any differences.  Please let me know if you see any.  I'd like to get that fixed both in this example and in the other version my framework uses.

John B.
Logged
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #46 on: May 26, 2006, 11:05:11 AM »

@Taneas : I think you're using VS.Net 2003 or 2002, not 2005. The .designer files are made automatically in 2005, to separate the designer-generated code and the user code... You won't be able to run 2005 code in VS.Net 2003, the project configuration changed and there are new language features as well.
Logged

Taneas
Customers
Community Member
*****
Posts: 159


« Reply #47 on: May 26, 2006, 11:45:52 AM »

No I have 2005...
Logged

- Working as Intended -
- FTW Studios Lead Developer -
- www.ftw-studios.com -
Taneas
Customers
Community Member
*****
Posts: 159


« Reply #48 on: May 26, 2006, 11:47:33 AM »

and i still get

{"The specified module could not be found. (Exception from HRESULT: 0x8007007E)":null}
Logged

- Working as Intended -
- FTW Studios Lead Developer -
- www.ftw-studios.com -
billythekid
Community Member
*
Posts: 814


« Reply #49 on: May 26, 2006, 11:50:55 AM »

That means you are missing a dll or linking to a bad dll. And that may even mean you are missing adobe acrobat like someone said. TV needs some dll thats installed with acrobat and not installed with vanilla winxp + vs2005.
Logged
Taneas
Customers
Community Member
*****
Posts: 159


« Reply #50 on: May 26, 2006, 04:49:48 PM »

Why would I need acrobat......

Its not like this is the first 6.5 app ive ever ran,.. lol

This is the FIRST 6.5 app ive ever had problems with.. and the ONLY....

and it highlights FRMMAIN when it says the specified module could not be found.
Logged

- Working as Intended -
- FTW Studios Lead Developer -
- www.ftw-studios.com -
darqSHADOW
Administrator
Community Member
*****
Posts: 2817


« Reply #51 on: May 26, 2006, 05:14:59 PM »

Have you ran Dependancy Walker against the EXE to see what you are missing?

DS
Logged

TrueVision3D Project Manager
The fast and simple way of 3D development.
billythekid
Community Member
*
Posts: 814


« Reply #52 on: May 26, 2006, 05:17:22 PM »

Yeah but the error isnt very useful. Its like gettiing a segmentation fault in C. Just through experience, I know its a linker issue.

Do you have acrobat? Just install it if not, no arguments!  Tongue
Logged
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #53 on: May 26, 2006, 06:16:42 PM »

Hey John,
While trying to debug the color mixup, I enabled Strict mode and saw a couple of oddities along the way...

CType(..., Single) --> You're aware that CSng() exists,...?
The MulChromaticityMatrices function... Why the hell do you used Thread-safe functions to emulate a for...next loop with a while?? I'm totally clueless. Probably c#-to-vb generated code.

I double-checked all of the constants (chromacity/perez coefficients, conversion matrix) and everything looks good... It must be the gamma, but I reviewed the code there and found nothing!
I'll make some debug output and compare values to find out where exactly is the problem, and post back.
Logged

JohnB
Customers
Community Member
*****
Posts: 183


« Reply #54 on: May 26, 2006, 07:07:23 PM »

Yeah - that's what happened there.  I had to go way back to get a version of the sky that wasn't all plugged into my framework.  To save time retyping everything I originally ran your example through a code converter then just debugged the converter's output.  Hard to remember exactly since that was several months ago.  Here's the combined code that replaced the Chromacity & mulChromacity functions in a later build in case anyone needs/wants it.

John B.


Code:
   '===============================================================================
    ' Chromaticity
    '===============================================================================
    Shared Function Chromaticity(ByVal ZC As Single(,), ByVal turbidity As Single, ByVal sunTheta As Single) As Single

        Dim sunThetaSquared As Single = sunTheta * sunTheta
        Dim sunThetaCubed As Single = sunThetaSquared * sunTheta
        Dim turbiditySquared As Single = Turbidity * Turbidity
        Dim turbidityVector As Single() = {turbiditySquared, Turbidity, 1.0}
        Dim sunThetaVector As Single() = {sunThetaCubed, sunThetaSquared, sunTheta, 1.0}
        Dim inter(4) As Single
        Dim i As Integer = 0

        While i < 4
            inter(i) = 0.0
            Dim j As Integer = 0

            While j < 3
                'inter(i) += lv(j) * mat(j, i)
                inter(i) = inter(i) + (turbidityVector(j) * ZC(j, i))
                System.Math.Min(System.Threading.Interlocked.Increment(j), j - 1)
            End While

            System.Math.Min(System.Threading.Interlocked.Increment(i), i - 1)

        End While

        Dim ret As Single = 0.0
        i = 0

        While i < 4
            'ret += inter(i) * cv(i)
            ret = ret + (inter(i) * sunThetaVector(i))
            System.Math.Min(System.Threading.Interlocked.Increment(i), i - 1)
        End While

        Return ret

    End Function
Logged
Taneas
Customers
Community Member
*****
Posts: 159


« Reply #55 on: May 26, 2006, 08:15:09 PM »

Ive got everything dependency walker says..  Sad
Logged

- Working as Intended -
- FTW Studios Lead Developer -
- www.ftw-studios.com -
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #56 on: May 26, 2006, 08:54:40 PM »

Alright good news, I found the problem Smiley
The "DistrubutionCoefficients" function had a typo in it, there should have been Y2 and there is Y1. I also fixed the array length, you made them 6-sized where they need to be 5-sized Tongue (remember, no "Option Base 1" in VB.Net...)

Here's the whole corrected function :
Code:
   Friend Function DistributionCoefficients(ByVal turbidity As Single) As xyYCoeffs

        Dim ret As xyYCoeffs

        ret.x = New Single(4) {}
        ret.y1 = New Single(4) {}
        ret.Y2 = New Single(4) {}

        Dim i As Integer = 0

        While i < 5
            ret.x(i) = XDistribCoeff(i, 0) * turbidity + XDistribCoeff(i, 1)
            ret.y1(i) = Y1DistribCoeff(i, 0) * turbidity + Y1DistribCoeff(i, 1)
            ret.Y2(i) = Y2DistribCoeff(i, 0) * turbidity + Y2DistribCoeff(i, 1)
            System.Math.Min(System.Threading.Interlocked.Increment(i), i - 1)
        End While

        Return ret

    End Function


Gives exact same results as the C# version now! Still the reddish horizon during daytime, but that was a known problem.
Logged

JohnB
Customers
Community Member
*****
Posts: 183


« Reply #57 on: May 27, 2006, 04:00:18 PM »

Thanks Zaknafein!

John B.
Logged
Taneas
Customers
Community Member
*****
Posts: 159


« Reply #58 on: May 28, 2006, 07:06:52 PM »

Ok.. I just formatted and I no longer get that error..

I do get an error on GameTime = "02/14/1968"

Invalid cast of String to Date...
Logged

- Working as Intended -
- FTW Studios Lead Developer -
- www.ftw-studios.com -
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #59 on: May 28, 2006, 08:20:33 PM »

I don't understand why you get all of these errors... but you can use the constructor instead to make it stop complaining.
i.e. GameTime = new Date(1968, 2, 14)
or something like that.
Logged

Pages: 1 2 [3] 4 5
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks