realbasic-games
[Top] [All Lists]

Re: shadows demo

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: shadows demo
From: Lo Saeteurn <realbasic at miensoftware dot com>
Date: Wed, 27 Sep 2006 17:48:28 -0700
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <20060927174851 dot F1F2B653FAA at mail dot verex dot com>
Looks awesome! Would it be possible to do this for non-flat surfaces?

There must be a way to use alphas with decent speeds... What if we used 1-bit alphas with a very small checkered pattern (basically putting holes on the mask)? Would that look okay?

On Sep 27, 2006, at 10:48 AM, joe at strout dot net wrote:

For those of you not also on the NUG, I just posted a message there
pointing out a demo of dynamic shadows
(http://www.strout.net/files/rb/shadows-demo.zip).

It also serves as a pretty good example of using the Trimesh and
Material classes.  The floor, for example, is a big checkered square,
and created entirely in code; there is no model for it.  I could have
done that with AddShapePicture, but it would have needed an enormous
texture -- this one gets away with a dinky 32x32 texture, and simply
repeats it by setting its UV values very large.

Anyway, check it out, and if you have any questions, let's discuss.

Cheers,
- Joe


--
Joe Strout -- joe at strout dot net
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


From  Wed 27 Sep 2006 21:42:13 -0600
Return-Path: <realbasic-games-bounces at lists dot realsoftware dot com>
X-Original-To: listarchive at realsoftware dot com
Delivered-To: listarchive at realsoftware dot com
Received: by xmail.realsoftware.com (Postfix, from userid 1037)
        id 8FBCAC88CF1; Wed, 27 Sep 2006 20:42:26 -0700 (PDT)
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on realxserve.local
X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=AWL,NO_REAL_NAME autolearn=disabled version=3.1.1
Received: from lists.realsoftware.com (lists.realsoftware.com [209.198.132.125])
        by xmail.realsoftware.com (Postfix) with ESMTP id 62C02C88CEA;
        Wed, 27 Sep 2006 20:42:24 -0700 (PDT)
Received: from lists.realsoftware.com (localhost [127.0.0.1])
        by lists.realsoftware.com (Postfix) with ESMTP
        id 9D651152FAA9; Wed, 27 Sep 2006 22:42:18 -0500 (CDT)
X-Original-To: realbasic-games at lists dot realsoftware dot com
Delivered-To: realbasic-games at lists dot realsoftware dot com
Received: from mail.verex.com (unknown [66.116.103.197])
        by lists.realsoftware.com (Postfix) with ESMTP id 3238A152FA91
        for <realbasic-games at lists dot realsoftware dot com>;
        Wed, 27 Sep 2006 22:42:14 -0500 (CDT)
Received: from [66.116.103.197] (localhost [127.0.0.1])
        by mail.verex.com (Postfix) with SMTP id C110F654521
        for <realbasic-games at lists dot realsoftware dot com>;
        Wed, 27 Sep 2006 21:42:13 -0600 (MDT)
Date: Wed, 27 Sep 2006 21:42:13 -0600
From: joe at strout dot net
To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
In-Reply-To: <50B68DB1-C67B-40B7-A6FF-076CFD3048BB at miensoftware dot com>
X-Mailer: VerEx Email Gateway
Content-type: text/plain;
Content-transfer-encoding: 7bit
Message-Id: <20060928034213 dot C110F654521 at mail dot verex dot com>
Subject: Re: shadows demo
X-BeenThere: realbasic-games at lists dot realsoftware dot com
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Sender: realbasic-games-bounces at lists dot realsoftware dot com
Errors-To: realbasic-games-bounces at lists dot realsoftware dot com

On Sep 28, 2006, at 00:48 UTC, Lo Saeteurn wrote:

Looks awesome! Would it be possible to do this for non-flat surfaces?

Yes, though it could get dicey if the object triangles are not much
smaller than the ground triangles.  You're projecting the individual
vertices down to the surface (or just above it); this needs to result
in triangles that stick pretty close to the surface.  If the surface
has sharp peaks or edges, you're probably going to find it poking
through the shadow.  On the other hand, I'd expect it to work fine if
the terrain is fairly smooth, and the object triangles are much smaller
than the terrain triangles.

There must be a way to use alphas with decent speeds...

It has nothing to do with speed.  Imagine taking your object (a zombie
hunter in this demo) and squashing it flat.  You've now got a LOT of
overlapping triangles in most places, and only a few overlapping
triangles in other places.  Overlapping translucent triangles blend
together; two semi-transparent panes of glass look darker than one, and
three look darker than two, etc.  So your shadow wouldn't be a uniform
darkness, as it should be, but instead would be a crazy hodgepodge of
different darknesses.  That's why we can't use alpha.

Of course, it *could* be that if all your triangles are in the same
plane, they wouldn't be blended.  I doubt it, but feel free to give it
a try.  Check out the MakeShadow method -- it shows how to switch from
the texture to a solid-colored shadow.  Add an alpha, and see how it
looks.

What if we used 1-bit alphas with a very small checkered pattern (basically putting holes on the mask)? Would that look okay?

I don't think so.  Though I remember that trick from 2D days of yore,
and it makes me smile!

Cheers,
- Joe

--
Joe Strout -- joe at strout dot net
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>