distorted waveset reflection

If you feel like you're up to the challenge of building your own Ages in Blender or 3ds Max, this is the place for you!

Re: distorted waveset reflection

Postby Jojon » Tue Oct 27, 2009 6:21 pm

Oh, wow. *throws away long confusing post with messy screenshot, written while the one above was submitted* :P

Congratulations Justin! Looking good. :)

I have yet to try it myself, but yes; I believe you should just need that "EnvMap" propery in your waveset's alcscript.
If you are not using this envmap also on other objects, you may need to have the texture block with the envmap, attached to a dummy material and that to a dummy object, to make sure it isn't flushed next time you save the project.
Jojon
 
Posts: 1116
Joined: Sun Sep 30, 2007 5:49 am

Re: distorted waveset reflection

Postby Justintime9 » Wed Oct 28, 2009 4:50 pm

After getting some help from Lontahv in Guild chat, I've now created my AlcScript:

Code: Select all
RpondWav:
    visual:
        waveset:
            envmap: PlaneEnvMap
            depthrange:
                opac:
                    start: 0
                    end: 10.5
            envradius: 7000
            winddir: Wind
            windspeed: 0.4


"PlaneEnvMap" is the name of my picture file (it's actually "PlaneEnvMap.jpg", but I didn't think the file extension was necessary). What I did, is first added the EnvMap to the Waveset plane (under load), but then on export blender complained about it not having any texture values (because I have a material and texture layer, but no UV mapping).

I then created an Empty mesh, and gave it my Waveset's material, and made it a single user. Then I deleted the texture layer from the Waveset object and turned off "Shadeless".

I kept the texture layer on the Empty object. (EnvMap > load > PlaneEnvMap.jpg). I left Shadless on for that. The way I understand it, when "PlaneEnvMap" is referenced in the AlcScript, it finds it on my Empty object, but still knows to use the Waveset object as the waveset.

Sadly I get the error "IndexError: List index out of range". I tried to see what could be wrong, but to no avail. In desparation I googled the error and found an Older GoW post with the error and conditions eerily similar to my problem: viewtopic.php?f=7&t=2490

what puzzles me is that the problem in that thread seems to have been the PyPRP version, but by now it's been updated and the problem presumably fixed.
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: distorted waveset reflection

Postby Jojon » Thu Oct 29, 2009 5:34 pm

Glad to hear that Lontahv could help.

I still have not found time to try my hand at using a "custom" envmap with a waveset, so I can not offer any help, but am I to take it, from your post, that you are referencing an Image block (The ones with "IM:" in the selection boxes), or possibly a disk file? I would have expected a Texture block ("TE:"), set to envmap type and with the picture loaded, but I certainly wouldn't know. Either way, if it's a Blender block, rather than a filename, I believe the full name, including the ".jpg" bit, would be needed -- it's not an identifying extension there, but just part of the block name. (I'd say you need the extension, even if it's a disk file, mind)

Also, inferred from your naming of the map: so the envmap should be a planar one, rather than cubic, then?

Hope you can sort it out (..and then enlighten the rest of us). :)
I'm going to need this, as well, so I will try too, as soon as I can.
Jojon
 
Posts: 1116
Joined: Sun Sep 30, 2007 5:49 am

Re: distorted waveset reflection

Postby Justintime9 » Thu Nov 12, 2009 9:16 pm

I finally got it to work! What I did is delete the empty object, give the waveset object the material with the "EnvMap" image property, and in the UV Image Editor window, I unwrapped the waveset object (without giving it a UV Texture). Finally, in the "Map Input" tab, I checked "UV". After doing that, and linking, the reflection looks perfect.


Now on to the next problem :P having a different reflection in the nighttime version of the age (to reflect the star skydome).

In my age I have a page swap property (the same thing as Minkata and Prad). The waveset with the Cloudy (day) sky EnvMap texture was originally the only waveset, and was put on the "Shared" page so it would show up in the daytime and nighttime.
Now the problem is that when I "link" to the nighttime (page), the water reflects the daytime sky, rather than the nighttime starry sky.

First what I did was copy my waveset, give it a starry sky EnvMap picture, and put it on the nighttime page, and the day one on the day page. This didn't work, so I put them both on the shared page, and after testing to see if both wavesets work, (deleting the daytime one to view the night one and vice versa) and tried making a visregion (confined to the Day page) that would make the night waveset disappear in the daytime, but when I linked in, neither waveset worked.

Here's my Visregion AlcScript:

Code: Select all
Nvisreg:
    type: softvolume
    softvolume:
        type: convex
        softdist: 2.0
   
RpondWavN:
    visual:
        visregions:
                  softvolume: Nvisreg
   
RpondWav:
    visual:
        visregions:
                  softvolume: "!(Nvisreg)"
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: distorted waveset reflection

Postby Robert The Rebuilder » Fri Nov 13, 2009 11:14 am

Marcello ran into a similar problem with paging and wavesets when he made his fantastic shell for Ahra Pahts. The waveset needs to be in the age from the beginning and cannot be loaded dynamically; that's why they need to be in your shared page.

Instead of using the visregion, try toggling the visibilities of each waveset when you do the page swap.
Can we rebuild it? Yes, we can - here's how.

MOULagain KI# 1299

Myst Movie coming soon - spread the word!
User avatar
Robert The Rebuilder
 
Posts: 1383
Joined: Sat Sep 29, 2007 7:24 am
Location: Virginia, US

Re: distorted waveset reflection

Postby Justintime9 » Fri Nov 13, 2009 5:02 pm

how would I do that? Something with the python files? Or is there an AlcScript parameter for it?
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: distorted waveset reflection

Postby Robert The Rebuilder » Fri Nov 13, 2009 5:08 pm

It would be in the place where you page the PRP files. If you're doing this via a Python file, then you can just get the waveset scene object and set its visibility at the same time you're paging in/out.

If you're somehow paging in/out the PRP files via AlcScript, I'm not exactly sure how do to this. If this is the case, could you show the AlcScript that does the paging?
Can we rebuild it? Yes, we can - here's how.

MOULagain KI# 1299

Myst Movie coming soon - spread the word!
User avatar
Robert The Rebuilder
 
Posts: 1383
Joined: Sat Sep 29, 2007 7:24 am
Location: Virginia, US

Re: distorted waveset reflection

Postby Justintime9 » Fri Nov 13, 2009 5:53 pm

Please bear with me, I'm Python and AlcScript is no my strong point :P. I'm looking through my "MyAge.py" python file and "Swap.py", but can't seem to find a place to toggle visibility. What exactly do you mean by "Page" the prp files? In Blender there's the "Book" text file where the sequence prefix and names of pages go, but I don't know what I'd put there. Would I use PrpExplorer to edit the prp files themselves?
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

Re: distorted waveset reflection

Postby Robert The Rebuilder » Sat Nov 14, 2009 4:17 pm

You mentioned above that you had a "page swap" property, similar to Minkata or Prad. Where did you declare that property?

And what does Swap.py look like (minus the Python glue code in the second half of the file)?
Can we rebuild it? Yes, we can - here's how.

MOULagain KI# 1299

Myst Movie coming soon - spread the word!
User avatar
Robert The Rebuilder
 
Posts: 1383
Joined: Sat Sep 29, 2007 7:24 am
Location: Virginia, US

Re: distorted waveset reflection

Postby Justintime9 » Sun Nov 15, 2009 11:48 am

You mentioned above that you had a "page swap" property, similar to Minkata or Prad. Where did you declare that property?


In the python file I believe (at least that's where I assign it to the button that will trigger it, put it's SDL variable name.)

here's the SwapButton.py:

Code: Select all
# emacs-mode: -*- python-*-
from Plasma import *
from PlasmaTypes import *
from PlasmaKITypes import *
actClickableObject = ptAttribActivator(1, 'Act: Clickable Object')
ObjectMsg = ptAttribString(2, 'Object String')
testObj = None
gWasMuted = 0
kButtonID = 1
kFadeOutID = 2
kAudioID = 3
kIdleID = 4
kFadeInID = 5
clickObj = 'DayNiteBut'
SDLName = 'SwapPageZefora'
sPages = ('ZeforaDay',
 'ZeforaNight')
sFog = ([1,
  1000,
  1],
 [1,
  1000,
  1])
sColors = ([0.0,
  0.0,
  0.0],
 [0.0,
  0.0,
  0.0])
linkEffects = 1
kButtonSeconds = 3.0
kFadeOutSeconds = 1.5
kAudioSeconds = 3.0
kIdleSeconds = 6.0
kFadeInSeconds = 1.5
sPage = 0
class SwapButton(ptModifier,):

    def __init__(self):
        ptModifier.__init__(self)
        self.version = '2'
        print ('__init__%s v.%s' % (self.__class__.__name__,
         self.version))



    def OnServerInitComplete(self):
        global testObj
        print ('%s: OnServerInitComplete' % self.__class__.__name__)
        try:
            testObj = PtFindSceneobject(clickObj, PtGetAgeName())
        except:
            print 'ERROR: Missing test object'
        ageSDL = PtGetAgeSDL()
        if (ageSDL == None):
            print 'ERROR: Missing SDL'
            return
        ageSDL.sendToClients(SDLName)
        ageSDL.setFlags(SDLName, 1, 1)
        ageSDL.setNotify(self.key, SDLName, 0.0)



    def OnNotify(self, state, id, events):
        print ('%s: OnNotify called' % self.__class__.__name__)
        if ((id == actClickableObject.id) and state):
            print ('Object %s clicked' % ObjectMsg.value)
            if (ObjectMsg.value == clickObj):
                if linkEffects:
                    PtAtTimeCallback(self.key, kButtonSeconds, kButtonID)
                else:
                    self.ISwapPage()



    def OnTimer(self, id):
        global gWasMuted
        print ('%s: OnTimer: id = %d' % (self.__class__.__name__,
         id))
        if (id == kButtonID):
            print 'Start fake link out'
            LocalAvatar = PtGetLocalAvatar()
            avKey = LocalAvatar.getKey()
            PtFakeLinkAvatarToObject(avKey, avKey)
            LocalAvatar.physics.disable()
            PtFadeOut(kFadeOutSeconds, 1)
            PtAtTimeCallback(self.key, kFadeOutSeconds, kFadeOutID)
        elif (id == kFadeOutID):
            print 'Disable navigation'
            PtSendKIMessage(kDisableKIandBB, 0)
            PtSetGlobalClickability(0)
            PtDisableMouseMovement()
            PtDisableMovementKeys()
            self.ISwapPage()
            PtAtTimeCallback(self.key, kAudioSeconds, kAudioID)
        elif (id == kAudioID):
            print 'Disable audio'
            audio = ptAudioControl()
            if audio.isMuted():
                gWasMuted = 1
            else:
                gWasMuted = 0
                audio.muteAll()
        elif (id == kIdleID):
            print 'Enable audio'
            if (not gWasMuted):
                audio = ptAudioControl()
                audio.unmuteAll()
            print 'Start fake link in'
            LocalAvatar = PtGetLocalAvatar()
            avKey = LocalAvatar.getKey()
            PtFakeLinkAvatarToObject(avKey, avKey)
            LocalAvatar.physics.enable()
            PtAtTimeCallback(self.key, kFadeInSeconds, kFadeInID)
        elif (id == kFadeInID):
            PtFadeIn(kFadeInSeconds, 0)
            print 'Enable navigation'
            PtEnableMovementKeys()
            PtEnableMouseMovement()
            PtSetGlobalClickability(1)
            PtSendKIMessage(kEnableKIandBB, 0)



    def OnPageLoad(self, what, who):
        global sPage
        print ('OnPageLoad: what=%s who=%s' % (what, who))
        if (what == kUnloaded):
            print ' - Page unloaded, continue'
            if sPage:
                PtPageInNode(sPage)
                sPage = 0
            PtAtTimeCallback(self.key, kIdleSeconds, kIdleID)



    def ISwapPage(self):
        global sPage
        ageSDL = PtGetAgeSDL()
        loadPage = ageSDL[SDLName][0]
        if loadPage:
            print ('Replace %s with %s' % (sPages[1], sPages[0]))
            sPage = sPages[0]
            PtPageOutNode(sPages[1])
            PtFogSetDefLinear(sFog[0][0], sFog[0][1], sFog[0][2])
            PtFogSetDefColor(ptColor(sColors[0][0], sColors[0][1], sColors[0][2], 1.0))
            PtSetClearColor(sColors[0][0], sColors[0][1], sColors[0][2])
            if (type(testObj) != type(None)):
                if testObj.isLocallyOwned():
                    print 'I am game owner, save state 0'
                    ageSDL[SDLName] = (0,)
        else:
            print ('Replace %s with %s' % (sPages[0], sPages[1]))
            sPage = sPages[1]
            PtPageOutNode(sPages[0])
            PtFogSetDefLinear(sFog[1][0], sFog[1][1], sFog[1][2])
            PtFogSetDefColor(ptColor(sColors[1][0], sColors[1][1], sColors[1][2], 1.0))
            PtSetClearColor(sColors[1][0], sColors[1][1], sColors[1][2])
            if (type(testObj) != type(None)):
                if testObj.isLocallyOwned():
                    print 'I am game owner, save state 1'
                    ageSDL[SDLName] = (1,)
User avatar
Justintime9
 
Posts: 1188
Joined: Sat Sep 29, 2007 5:37 am

PreviousNext

Return to Building

Who is online

Users browsing this forum: No registered users and 1 guest