Discussion:
[Crystal-develop] Few Questions
Naman Gupta
2014-05-12 20:11:38 UTC
Permalink
Hi,

I encountered few problem would appreciate if someone could answer.

1). Is there a way to retrieve information about the adjacent vertex in
vertex shader?

2). The water waves are created by translating heightmaps in waterdemo2,
upon closing looking, you could see the waves aren't translating smoothly
because color values are discrete. This is the shader code
" ...
vec2 Texcord = texCoord + waveInput.time*10.0 ;
position_object.y += texture2D(texHeight, Texcord/128).r * 2.0;
..."
Is there are way to like interpolate the values between two consecutive
colors to make waves go smoother?

2). How do we add texture to the inner side of a box generated like this
"...
CS::Geometry::DensityTextureMapper mapper (0.3f);
CS::Geometry::TesselatedBox box (csVector3 (0, 0, 0), csVector3 (10, 10,
10));
box.SetLevel (3);
box.SetMapper (&mapper);
box.SetFlags (CS::Geometry::Primitives::CS_PRIMBOX_INSIDE);

// Now we make a factory and a mesh at once.
csRef<iMeshWrapper> walls =
CS::Geometry::GeneralMeshBuilder::CreateFactoryAndMesh (
engine, room, "walls", "walls_factory", &box);
..."

I'm trying to make a skybox.


Also, Could someone get the search functionality working on the
documentation given in the link "
http://www.crystalspace3d.org/docs/online/manual/"?

~N
Matthieu Kraus
2014-05-13 15:41:09 UTC
Permalink
Naman Gupta [mailto:]=20
1970-01-01 00:00:00 UTC
Permalink
------=_NextPart_000_0037_01CF6ED2.869A7250
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

1) None that I know of – shaders are data-parallel and accordingly you only get the information of the piece you’re processing

2) Filtering is disabled for heightmaps iirc (to prevent awkward interpolation) – you can do it manually, though (query the adjacent texels and interpolate manually using the properly converted height value)

3) Once you have the mesh you can set a material on it (either create a new one and set the shader, textures, etc. as desired or grab one you loaded or got elsewhere and simply set it on the mesh)



From: Naman Gupta [mailto:***@gmail.com]
Sent: Monday, May 12, 2014 22:12
To: crystal-***@lists.sourceforge.net
Subject: [Crystal-develop] Few Questions



Hi,

I encountered few problem would appreciate if someone could answer.

1). Is there a way to retrieve information about the adjacent vertex in vertex shader?

2). The water waves are created by translating heightmaps in waterdemo2, upon closing looking, you could see the waves aren't translating smoothly because color values are discrete. This is the shader code
" ...
vec2 Texcord = texCoord + waveInput.time*10.0 ;
position_object.y += texture2D(texHeight, Texcord/128).r * 2.0;
..."
Is there are way to like interpolate the values between two consecutive colors to make waves go smoother?

2). How do we add texture to the inner side of a box generated like this
"...
CS::Geometry::DensityTextureMapper mapper (0.3f);

CS::Geometry::TesselatedBox box (csVector3 (0, 0, 0), csVector3 (10, 10, 10));

box.SetLevel (3);

box.SetMapper (&mapper);

box.SetFlags (CS::Geometry::Primitives::CS_PRIMBOX_INSIDE);



// Now we make a factory and a mesh at once.

csRef<iMeshWrapper> walls = CS::Geometry::GeneralMeshBuilder::CreateFactoryAndMesh (

engine, room, "walls", "walls_factory", &box);
..."

I'm trying to make a skybox.


Also, Could someone get the search functionality working on the documentation given in the link "http://www.crystalspace3d.org/docs/online/manual/"?

~N


------=_NextPart_000_0037_01CF6ED2.869A7250
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1448424008;
mso-list-type:hybrid;
mso-list-template-ids:-1684106582 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
{mso-level-text:"%1\)";
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1" /> </o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>1)<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>None that I know of – shaders are data-parallel and accordingly you only get the information of the piece you’re processing<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>2)<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Filtering is disabled for heightmaps iirc (to prevent awkward interpolation) – you can do it manually, though (query the adjacent texels and interpolate manually using the properly converted height value) <o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><span style='mso-list:Ignore'>3)<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Once you have the mesh you can set a material on it (either create a new one and set the shader, textures, etc. as desired or grab one you loaded or got elsewhere and simply set it on the mesh)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>From:</span></b><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'> Naman Gupta [mailto:***@gmail.com] <br><b>Sent:</b> Monday, May 12, 2014 22:12<br><b>To:</b> crystal-***@lists.sourceforge.net<br><b>Subject:</b> [Crystal-develop] Few Questions<o:p></o:p></span></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><div><p class=MsoNormal>Hi,<br><br>&nbsp; &nbsp; I encountered few problem would appreciate if someone could answer.<br><br>1). Is there a way to retrieve information&nbsp;about the adjacent vertex in vertex shader?<br><br>2). The water waves are created by translating heightmaps in waterdemo2, upon closing looking, you could see the waves aren't translating smoothly because color values are discrete. This is the shader code<br>&quot; ...<br>vec2 Texcord = texCoord + waveInput.time*10.0 ;<br>position_object.y += texture2D(texHeight, Texcord/128).r * 2.0;<br>...&quot;<br>Is there are way to like interpolate the values between two consecutive colors to make waves go smoother?&nbsp;&nbsp;<br><br>2). How do we add texture to the inner side of a box generated like this&nbsp;<br>&quot;...<br>&nbsp; CS::Geometry::DensityTextureMapper mapper (0.3f);<o:p></o:p></p><div><p class=MsoNormal>&nbsp; CS::Geometry::TesselatedBox box (csVector3 (0, 0, 0), csVector3 (10, 10, 10));<o:p></o:p></p></div><div><p class=MsoNormal>&nbsp; box.SetLevel (3);<o:p></o:p></p></div><div><p class=MsoNormal>&nbsp; box.SetMapper (&amp;mapper);<o:p></o:p></p></div><div><p class=MsoNormal>&nbsp; box.SetFlags (CS::Geometry::Primitives::CS_PRIMBOX_INSIDE);<o:p></o:p></p></div><div><p class=MsoNormal><o:p>&nbsp;</o:p></p></div><div><p class=MsoNormal>&nbsp; // Now we make a factory and a mesh at once.<o:p></o:p></p></div><div><p class=MsoNormal>&nbsp; csRef&lt;iMeshWrapper&gt; walls = &nbsp; CS::Geometry::GeneralMeshBuilder::CreateFactoryAndMesh (<o:p></o:p></p></div><p class=MsoNormal>            &nbsp;engine, room, &quot;walls&quot;, &quot;walls_factory&quot;, &amp;box);<br>...&quot;<br><br>I'm trying to make a skybox.&nbsp;<br><br><br>Also, Could someone get the search functionality working on the documentation given in the link &quot;<a href="http://www.crystalspace3d.org/docs/online/manual/">http://www.crystalspace3d.org/docs/online/manual/</a>&quot;?<br><br>~N<o:p></o:p></p></div></div></body></html>
------=_NextPart_000_0037_01CF6ED2.869A7250--

Loading...