<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>[RESOLVED] GX_SetFog has anybody ever tried using it?</title>
<description> I tried setting it up but its parameters are unusual to me. I mostly either get a completly red screen or a redish tint. I want to use it so that objects coming to wards the screen in my game are slightly hidden behind the fog.</description><link>http://forum.wiibrew.org/read.php?11,63485,63485#msg-63485</link><lastBuildDate>Thu, 05 Mar 2026 08:33:41 +0100</lastBuildDate>
<generator>Phorum 5.2.23</generator>
<item>
<guid>http://forum.wiibrew.org/read.php?11,63485,63596#msg-63596</guid>
<title>Re: GX_SetFog has anybody ever tried using it?</title><link>http://forum.wiibrew.org/read.php?11,63485,63596#msg-63596</link><description><![CDATA[ Considering the amount of time I spent on it you would think that the fog would be a critical feature but its really cosmetic at this point. This is a early version of my project: [<a href="http://www.youtube.com/watch?v=3oMh5d9XXvE&feature=player_embedded" rel="nofollow">www.youtube.com</a>] (no fog) rest of the info is on my wiibrew page.]]></description>
<dc:creator>owen</dc:creator>
<category>Coding</category><pubDate>Thu, 30 Dec 2010 15:59:38 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,63485,63593#msg-63593</guid>
<title>Re: GX_SetFog has anybody ever tried using it?</title><link>http://forum.wiibrew.org/read.php?11,63485,63593#msg-63593</link><description><![CDATA[ I look forward to your project! Glad I could help.]]></description>
<dc:creator>dancinninja</dc:creator>
<category>Coding</category><pubDate>Thu, 30 Dec 2010 07:38:14 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,63485,63589#msg-63589</guid>
<title>Re: GX_SetFog has anybody ever tried using it?</title><link>http://forum.wiibrew.org/read.php?11,63485,63589#msg-63589</link><description><![CDATA[ RESOLVED!! After what feels like months of painful trail and error I finally found out what was wrong with my code. I had misinterpreted what the parameters ment. The fog seems to work based on the draw distance of the camera as opposed to my "real world" coordinates. here is the code that seems to work now;<br />Note that the copyclear color call really makes the effect work, so don&#039;t go drawing plasma graphics in the background ( all your polygons will look like the night stage in DKReturns [<a href="http://www.youtube.com/watch?v=9wchQ-6pShk" rel="nofollow">www.youtube.com</a>] ).<br /><pre class="bbcode">
float camera_draw_distance=10000;
		GRRLIB_3dMode(1,camera_draw_distance,45,0,0);

void draw_fog( u32 color ) {
	GXColor fogcolor = {R(color),G(color),B(color),A(color)};
	GX_SetFog(GX_FOG_LIN, 0, camera_draw_distance/2, 1, camera_draw_distance, fogcolor);
	GX_SetCopyClear(fogcolor, GX_MAX_Z24);
}</pre><br />thanx dancinninja, I could not have figured it out without your help. Now for the snow! lol]]></description>
<dc:creator>owen</dc:creator>
<category>Coding</category><pubDate>Thu, 30 Dec 2010 05:54:02 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,63485,63582#msg-63582</guid>
<title>Re: GX_SetFog has anybody ever tried using it?</title><link>http://forum.wiibrew.org/read.php?11,63485,63582#msg-63582</link><description><![CDATA[ Yeah, minus the snow, that&#039;s what fog looks like.]]></description>
<dc:creator>dancinninja</dc:creator>
<category>Coding</category><pubDate>Wed, 29 Dec 2010 23:40:44 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,63485,63562#msg-63562</guid>
<title>Re: GX_SetFog has anybody ever tried using it?</title><link>http://forum.wiibrew.org/read.php?11,63485,63562#msg-63562</link><description><![CDATA[ something like this (without the snow particle effects): [<a href="http://www.youtube.com/watch?v=gtDVUgaDXDc&feature=related" rel="nofollow">www.youtube.com</a>]<br /><br />if looks basically like that I;d be ok. still haven&#039;t gotten a chance to test out the above code yet though.]]></description>
<dc:creator>owen</dc:creator>
<category>Coding</category><pubDate>Wed, 29 Dec 2010 07:08:40 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,63485,63560#msg-63560</guid>
<title>Re: GX_SetFog has anybody ever tried using it?</title><link>http://forum.wiibrew.org/read.php?11,63485,63560#msg-63560</link><description><![CDATA[ If you set your background/clear color to the same color as the fog, it should be the same as having 100% fog where you have no polygons on the screen.<br /><pre class="bbcode">
GX_SetCopyClear(fogcolor, GX_MAX_Z24);</pre>
Then again, I&#039;m not quite sure what you&#039;re going for.]]></description>
<dc:creator>dancinninja</dc:creator>
<category>Coding</category><pubDate>Wed, 29 Dec 2010 05:42:33 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,63485,63557#msg-63557</guid>
<title>Re: GX_SetFog has anybody ever tried using it?</title><link>http://forum.wiibrew.org/read.php?11,63485,63557#msg-63557</link><description><![CDATA[ hmmm yes I never had that GX_InitFogAdjTable() and GX_SetFogRangeAdj() call but I have seen that white tint effect during some of my experiments and it doesn;t look pretty at all :(. Its going to be tricky with the fact that I have absolutely no polygons in some areas of my screen (and i was hoping that the fog function would be ideal to hide this fact) but I will give this a try. thanx for your help,<br /><br />ps if all else fails I&#039;ll attempt to draw thousands of dots,all across the screen lol.]]></description>
<dc:creator>owen</dc:creator>
<category>Coding</category><pubDate>Wed, 29 Dec 2010 04:28:53 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,63485,63555#msg-63555</guid>
<title>Re: GX_SetFog has anybody ever tried using it?</title><link>http://forum.wiibrew.org/read.php?11,63485,63555#msg-63555</link><description><![CDATA[ I found my fog code! Here&#039;s what I used (modified for simplicity):<br /><br /><pre class="bbcode">
// Previously defined variables:
Mtx44 projection;
f32 width, height;

// Fog variables
GXFogAdjTbl fogTable;
bool fogAdjust = true;
GXColor fogcolor = {128,128,128,255};

// Set up the projection matrix
guPerspective(projection, 45, width/height, 16.0f, 1024.0f);
GX_LoadProjectionMtx(projection, GX_PERSPECTIVE);

// Set pixel processing mode
GX_SetBlendMode(GX_BM_BLEND, GX_BL_ONE, GX_BL_ZERO, GX_LO_CLEAR);
GX_SetZMode(GX_TRUE, GX_LESS, GX_TRUE);

// Start the fog at 16 and end at 
GX_SetFog(GX_FOG_LIN, 16.0f, 1024.0f, 16.0f, 1024.0f, fogcolor);

// Adjust the scene so that the sides of the screen are properly fogged.
if (fogAdjust){
    GX_InitFogAdjTable(&fogTable, (u16) width, projection);
    GX_SetFogRangeAdj(GX_ENABLE, (u16) width/2, &fogTable);
}
else{
    GX_SetFogRangeAdj(GX_DISABLE, 0, NULL);
}</pre>
The fog does seem to be a "white tint" as you call it. The entire screen is not actually blanketed in fog. GX calculates the fog for each polygon&#039;s distance from the viewer. Use the same background color as the fog and the objects will appear to "fade" into the distance.]]></description>
<dc:creator>dancinninja</dc:creator>
<category>Coding</category><pubDate>Wed, 29 Dec 2010 03:11:03 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,63485,63529#msg-63529</guid>
<title>Re: GX_SetFog has anybody ever tried using it?</title><link>http://forum.wiibrew.org/read.php?11,63485,63529#msg-63529</link><description><![CDATA[ I&#039;ve tried setting it to the correct matrix settings (0, -10000) but I&#039;m going to try using positive numbers and see how it works out.<br /><br />Do you remember how the fog is supposed to look? is it like WHITE TINT on the whole screen or does it look like real fog/mist with volume? If you have any videos with how the end results looks that would be helpful.]]></description>
<dc:creator>owen</dc:creator>
<category>Coding</category><pubDate>Tue, 28 Dec 2010 17:24:46 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,63485,63509#msg-63509</guid>
<title>Re: GX_SetFog has anybody ever tried using it?</title><link>http://forum.wiibrew.org/read.php?11,63485,63509#msg-63509</link><description><![CDATA[ Here is how the fog function is defined in libogc:<br /><br /><pre class="bbcode">
void GX_SetFog(u8 type, f32 startz, f32 endz, f32 nearz, f32 farz, GXColor col);</pre><br />Let&#039;s start with this one (using perspective):<br /><br />GX_SetFog (GX_FOG_PERSP_EXP ,-620,-630,-600,-650, c );<br /><br />The start and end are awfully close to each other, but I think the problem would the nearz and farz, which need to match the projection matrix parameters. Let&#039;s say that we use a perspective projection like so:<br /><br /><pre class="bbcode">
guPerspective(projection, 45, width/height, 0.1f, 100.0f);
GX_LoadProjectionMtx(projection, GX_PERSPECTIVE);</pre><br />Then our SetFog function would need to be called like this:<br /><pre class="bbcode">
GX_SetFog (GX_FOG_PERSP_EXP , 620, 630, 0.1f, 100.0f, c );</pre><br />I think the values are positive when passing to the fog function. Also, if you&#039;re using perspective, try GX_FOG_LIN (it&#039;s the same as GX_FOG_PERSP_LIN) to see if that&#039;s better for you.<br /><br />I should warn you though, I haven&#039;t used fog in a while.]]></description>
<dc:creator>dancinninja</dc:creator>
<category>Coding</category><pubDate>Tue, 28 Dec 2010 06:32:57 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,63485,63505#msg-63505</guid>
<title>Re: GX_SetFog has anybody ever tried using it?</title><link>http://forum.wiibrew.org/read.php?11,63485,63505#msg-63505</link><description><![CDATA[ I&#039;ve tried several combinations and coordinates but all I get is either all polygons are rendered totally black or there is a black fog over everything;<br /><br />GXColor c = {10, 10, 10};<br />GX_SetFog ( GX_FOG_ORTHO_EXP, -300, -600, 0, -10000, c );<br />OR<br />GX_SetFog ( GX_FOG_PERSP_EXP ,-620,-630,-600,-650, c );<br /><br />not sure if I need to use Z coords that are in the positive but I don&#039;t think that should matter.<br /><br />My camera is set to;<br /><br />GRRLIB_3dMode(0.1,-10000,45,0,0);]]></description>
<dc:creator>owen</dc:creator>
<category>Coding</category><pubDate>Tue, 28 Dec 2010 04:39:32 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,63485,63499#msg-63499</guid>
<title>Re: GX_SetFog has anybody ever tried using it?</title><link>http://forum.wiibrew.org/read.php?11,63485,63499#msg-63499</link><description><![CDATA[ What&#039;s the code that you&#039;re using?]]></description>
<dc:creator>dancinninja</dc:creator>
<category>Coding</category><pubDate>Tue, 28 Dec 2010 02:54:52 +0100</pubDate></item>
<item>
<guid>http://forum.wiibrew.org/read.php?11,63485,63485#msg-63485</guid>
<title>[RESOLVED] GX_SetFog has anybody ever tried using it?</title><link>http://forum.wiibrew.org/read.php?11,63485,63485#msg-63485</link><description><![CDATA[ I tried setting it up but its parameters are unusual to me. I mostly either get a completly red screen or a redish tint. I want to use it so that objects coming to wards the screen in my game are slightly hidden behind the fog.]]></description>
<dc:creator>owen</dc:creator>
<category>Coding</category><pubDate>Mon, 27 Dec 2010 20:28:36 +0100</pubDate></item>
</channel>
</rss>