Message from discussion
Data parsimony and WebGL shaders
Received: by 10.236.185.70 with SMTP id t46mr5146969yhm.5.1337271372664;
Thu, 17 May 2012 09:16:12 -0700 (PDT)
X-BeenThere: disc...@sfcomplex.org
Received: by 10.236.128.9 with SMTP id e9ls2519576yhi.9.gmail; Thu, 17 May
2012 09:16:12 -0700 (PDT)
Received: by 10.236.78.2 with SMTP id f2mr8352958yhe.118.1337271371980;
Thu, 17 May 2012 09:16:11 -0700 (PDT)
Received: by 10.236.78.2 with SMTP id f2mr8352953yhe.118.1337271371951;
Thu, 17 May 2012 09:16:11 -0700 (PDT)
Return-Path: <odensm...@gmail.com>
Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52])
by mx.google.com with ESMTPS id y5si5916922yha.129.2012.05.17.09.16.11
(version=TLSv1/SSLv3 cipher=OTHER);
Thu, 17 May 2012 09:16:11 -0700 (PDT)
Received-SPF: pass (google.com: domain of odensm...@gmail.com designates 209.85.213.52 as permitted sender) client-ip=209.85.213.52;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of odensm...@gmail.com designates 209.85.213.52 as permitted sender) smtp.mail=odensm...@gmail.com; dkim=pass header...@gmail.com
Received: by yhpp61 with SMTP id p61so3055081yhp.39
for <disc...@sfcomplex.org>; Thu, 17 May 2012 09:16:11 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:sender:in-reply-to:references:date
:x-google-sender-auth:message-id:subject:from:to:content-type;
bh=7STIwAwTWryieuxvD/CbkRiP6R+yLHQ22aGRnqSQSM4=;
b=zzHiwIcIGqWE5KwjlIzgvN7nNZY0K8RNzqe/eGjLJMS8IsK3y/lrxlX60cf53JE6aT
AKcH+G3p7decQin0GaBLgIYvEm+TV5N/z0GEZZXxlJZKYtlGWeRYGztM1gre/8e4iq78
3DIYmFhnTgmyYUOplV7Zpzp3vYZYkt0qp+Ic6s0w6x3lSUZspspg5ONUNSv6+FJ95ZiD
WhBMtA3sWg1il69k/sUB5laMJYRe192sCAgGhsh70LW1C38N3kWV+c72NEdBh/ZxpmiA
oN7y0skLdaqyxc+rjnGP3su29ztclhILSuIuyDN0M/39mndHh2tYQppI9Z+xQm8q0pMQ
cBCg==
MIME-Version: 1.0
Received: by 10.236.103.106 with SMTP id e70mr8535878yhg.121.1337271371656;
Thu, 17 May 2012 09:16:11 -0700 (PDT)
Sender: odensm...@gmail.com
Received: by 10.147.99.17 with HTTP; Thu, 17 May 2012 09:16:11 -0700 (PDT)
In-Reply-To: <CA+WuaSeBEbHog9=_QVWSuvKztHmZ6EU9S_g9Y8--p+z8aVp...@mail.gmail.com>
References: <CA+WuaSeBEbHog9=_QVWSuvKztHmZ6EU9S_g9Y8--p+z8aVp...@mail.gmail.com>
Date: Thu, 17 May 2012 10:16:11 -0600
Message-ID: <CAN_LYRmR1VskeFyTor1troAgSNz=EA1tWSU-Fz89ETwXjFP...@mail.gmail.com>
Subject: Re: [sfx: Discuss] Data parsimony and WebGL shaders
From: Owen Densmore <o...@backspaces.net>
To: disc...@sfcomplex.org
Content-Type: multipart/alternative; boundary=20cf302d49c4136f3004c03dc18c
--20cf302d49c4136f3004c03dc18c
Content-Type: text/plain; charset=ISO-8859-1
Fascinating!
I looked at the CS code and it made a lot of sense. What wasn't clear is
the GPU interactions.
So in terms of data sent to the shader, I'm guessing you send just the
vertices to your vertex attribute buffer, so you don't have to store
multiple copies of the same vertex in the GPU. You then have a pretty
sophisticated binding of these vertices to the image for texture drawing.
Is that right? .. or do you have to replicate the vertices to keep the
shaders simple?
Just as a point of interest, where *are* the shaders? My guess is that
GlowScript has a set of standard shaders and separate program objects for
standard use.
CS/GS certainly are very readable.
-- Owen
On Thu, May 17, 2012 at 9:33 AM, Bruce Sherwood <bruce.sherw...@gmail.com>wrote:
> I've had a lot of trouble with WebGL shader code working on my Windows
> machine and failing on a Macbook Pro and Ubuntu, all with NVIDIA
> graphics and drivers.
>
> I did a lot of work to ensure that I send to each of the many shaders
> only that data that is actually referenced and used by that particular
> shader, and this change made mouse picking and transparency work again
> on all platforms. Moral of the tale: don't send anything from CPU to
> shaders that the shaders aren't going to use, even though this works
> okay on Windows. It seems to me that the shader compilers in the Mac
> and Ubuntu drivers are wrong, but at least now I know what to do to
> preserve cross-platform compatibility.
>
> In other news, over the last couple of weeks I had intensive
> discussions with David Scherer about the GlowScript API for creating
> your own models out of triangles or quads and dynamically modifying
> them to change the shape of the object. I'm working toward a major
> release, 1.0. Some time ago I posted an example of a pulse moving
> along a rug, which has been rewritten with the new API:
>
> http://www.glowscript.org/#/user/Bruce_Sherwood/folder/Pub/program/Rug
>
> To take the rug as a specific example, I create a set of vertices
> covering the rug in a rectangular pattern. I then create quad objects
> for each group of 4 vertices, with vertices internal to the rug shared
> among 4 adjacent quads. The animation of the pulse running along the
> rug is then done simply by modifying the vertices, with no need to
> think about the quads that make the display. Take a look at the
> CoffeeScript source code for the rug; it's now quite simple.
>
> Bruce
>
> --
> You received this message because you are subscribed to the Santa Fe
> Complex "discuss" group.
> To post to this group, send email to disc...@sfcomplex.org
> To unsubscribe from this group, send email to
> discuss+unsubscr...@sfcomplex.org
> For more options, visit this group at
> http://groups.google.com/a/sfcomplex.org/group/discuss
>
--20cf302d49c4136f3004c03dc18c
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<font color=3D"#000000"><font><font face=3D"verdana,sans-serif">Fascinating=
!</font></font></font><div><font color=3D"#000000"><font><font face=3D"verd=
ana,sans-serif"><br></font></font></font></div><div><font color=3D"#000000"=
><font><font face=3D"verdana,sans-serif">I looked at the CS code and it mad=
e a lot of sense. =A0What wasn't clear is the GPU interactions.</font><=
/font></font></div>
<div><font color=3D"#000000"><font><font face=3D"verdana,sans-serif"><br></=
font></font></font></div><div><font color=3D"#000000"><font><font face=3D"v=
erdana,sans-serif">So in terms of data sent to the shader, I'm guessing=
you send just the vertices to your vertex attribute buffer, so you don'=
;t have to store multiple copies of the same vertex in the GPU. =A0You then=
have a pretty sophisticated binding of these vertices to the image for tex=
ture drawing. =A0Is that right? =A0.. or do you have to replicate the verti=
ces to keep the shaders simple?</font></font></font></div>
<div><font color=3D"#000000"><font><font face=3D"verdana,sans-serif"><br></=
font></font></font></div><div><font color=3D"#000000"><font><font face=3D"v=
erdana,sans-serif">Just as a point of interest, where *are* the shaders? =
=A0My guess is that GlowScript has a set of standard shaders and separate p=
rogram objects for standard use.</font></font></font></div>
<div><font color=3D"#000000"><font><font face=3D"verdana,sans-serif"><br></=
font></font></font></div><div><font color=3D"#000000"><font><font face=3D"v=
erdana,sans-serif">CS/GS certainly are very readable.</font></font></font><=
/div>
<div><font color=3D"#000000"><font><font face=3D"verdana,sans-serif"><br></=
font></font></font></div><div><font color=3D"#000000"><font><font face=3D"v=
erdana,sans-serif">=A0 =A0-- Owen=A0<br></font></font></font><br><div class=
=3D"gmail_quote">
On Thu, May 17, 2012 at 9:33 AM, Bruce Sherwood <span dir=3D"ltr"><<a hr=
ef=3D"mailto:bruce.sherw...@gmail.com" target=3D"_blank">bruce.sherwood@gma=
il.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"=
margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I've had a lot of trouble with WebGL shader code working on my Windows<=
br>
machine and failing on a Macbook Pro and Ubuntu, all with NVIDIA<br>
graphics and drivers.<br>
<br>
I did a lot of work to ensure that I send to each of the many shaders<br>
only that data that is actually referenced and used by that particular<br>
shader, and this change made mouse picking and transparency work again<br>
on all platforms. Moral of the tale: don't send anything from CPU to<br=
>
shaders that the shaders aren't going to use, even though this works<br=
>
okay on Windows. It seems to me that the shader compilers in the Mac<br>
and Ubuntu drivers are wrong, but at least now I know what to do to<br>
preserve cross-platform compatibility.<br>
<br>
In other news, over the last couple of weeks I had intensive<br>
discussions with David Scherer about the GlowScript API for creating<br>
your own models out of triangles or quads and dynamically modifying<br>
them to change the shape of the object. I'm working toward a major<br>
release, 1.0. Some time ago I posted an example of a pulse moving<br>
along a rug, which has been rewritten with the new API:<br>
<br>
<a href=3D"http://www.glowscript.org/#/user/Bruce_Sherwood/folder/Pub/progr=
am/Rug" target=3D"_blank">http://www.glowscript.org/#/user/Bruce_Sherwood/f=
older/Pub/program/Rug</a><br>
<br>
To take the rug as a specific example, I create a set of vertices<br>
covering the rug in a rectangular pattern. I then create quad objects<br>
for each group of 4 vertices, with vertices internal to the rug shared<br>
among 4 adjacent quads. The animation of the pulse running along the<br>
rug is then done simply by modifying the vertices, with no need to<br>
think about the quads that make the display. Take a look at the<br>
CoffeeScript source code for the rug; it's now quite simple.<br>
<span class=3D"HOEnZb"><font color=3D"#888888"><br>
Bruce<br>
<br>
--<br>
You received this message because you are subscribed to the Santa Fe Comple=
x "discuss" group.<br>
To post to this group, send email to <a href=3D"mailto:disc...@sfcomplex.or=
g">disc...@sfcomplex.org</a><br>
To unsubscribe from this group, send email to<br>
<a href=3D"mailto:discuss%2Bunsubscr...@sfcomplex.org">discuss+unsubscribe@=
sfcomplex.org</a><br>
For more options, visit this group at<br>
<a href=3D"http://groups.google.com/a/sfcomplex.org/group/discuss" target=
=3D"_blank">http://groups.google.com/a/sfcomplex.org/group/discuss</a><br>
</font></span></blockquote></div><br></div>
--20cf302d49c4136f3004c03dc18c--