• 9
• 9
• 10
• 9
• 10
• ### Similar Content

• By lxjk
Hi guys,
There are many ways to do light culling in tile-based shading. I've been playing with this idea for a while, and just want to throw it out there.
Because tile frustums are general small compared to light radius, I tried using cone test to reduce false positives introduced by commonly used sphere-frustum test.
On top of that, I use distance to camera rather than depth for near/far test (aka. sliced by spheres).
This method can be naturally extended to clustered light culling as well.
The following image shows the general ideas

Performance-wise I get around 15% improvement over sphere-frustum test. You can also see how a single light performs as the following: from left to right (1) standard rendering of a point light; then tiles passed the test of (2) sphere-frustum test; (3) cone test; (4) spherical-sliced cone test

I put the details in my blog post (https://lxjk.github.io/2018/03/25/Improve-Tile-based-Light-Culling-with-Spherical-sliced-Cone.html), GLSL source code included!

Eric

• Good evening everyone!

I was wondering if there is something equivalent of  GL_NV_blend_equation_advanced for AMD?
Basically I'm trying to find more compatible version of it.

Thank you!

• Hello guys,

How do I know? Why does wavefront not show for me?
I already checked I have non errors yet.

And my download (mega.nz) should it is original but I tried no success...
- Add blend source and png file here I have tried tried,.....

PS: Why is our community not active? I wait very longer. Stop to lie me!
Thanks !

• I wasn't sure if this would be the right place for a topic like this so sorry if it isn't.
I'm currently working on a project for Uni using FreeGLUT to make a simple solar system simulation. I've got to the point where I've implemented all the planets and have used a Scene Graph to link them all together. The issue I'm having with now though is basically the planets and moons orbit correctly at their own orbit speeds.
I'm not really experienced with using matrices for stuff like this so It's likely why I can't figure out how exactly to get it working. This is where I'm applying the transformation matrices, as well as pushing and popping them. This is within the Render function that every planet including the sun and moons will have and run.
if (tag != "Sun") { glRotatef(orbitAngle, orbitRotation.X, orbitRotation.Y, orbitRotation.Z); } glPushMatrix(); glTranslatef(position.X, position.Y, position.Z); glRotatef(rotationAngle, rotation.X, rotation.Y, rotation.Z); glScalef(scale.X, scale.Y, scale.Z); glDrawElements(GL_TRIANGLES, mesh->indiceCount, GL_UNSIGNED_SHORT, mesh->indices); if (tag != "Sun") { glPopMatrix(); } The "If(tag != "Sun")" parts are my attempts are getting the planets to orbit correctly though it likely isn't the way I'm meant to be doing it. So I was wondering if someone would be able to help me? As I really don't have an idea on what I would do to get it working. Using the if statement is truthfully the closest I've got to it working but there are still weird effects like the planets orbiting faster then they should depending on the number of planets actually be updated/rendered.

• Hello everyone,
I have problem with texture

# OpenGL FX Composer issues with cgfx

This topic is 2173 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I got a basic CgFX shader working in FX composer that has transformation and texturing, but I'm having some issues.. If I render it in OpenGL mode It renders fine in the perspective view, but in the material view the sample sphere doesnt show, the whole thing is black..

If I change to DirectX9 or 10 only a red wireframe mesh shows up, both in the material preview and in the perspective view.. CG is cross platform, but what about CgFX? Do I need a .fx file for rendering cg shaders in directx? If so, would I need that in my application aswell?

 void mainVS(float4 position : POSITION, float3 normal : NORMAL, float2 texCoord : TEXCOORD0, out float4 oPosition : POSITION, out float2 oTexCoord : TEXCOORD0, uniform float4x4 viewProjection, uniform float4x4 world) { oPosition = mul(world, position); oPosition = mul(viewProjection, oPosition); oTexCoord = texCoord; } void mainFS(float2 texCoord : TEXCOORD0, out float4 color : COLOR, uniform sampler2D colorSampler) { color = tex2D(colorSampler, texCoord); } float4x4 world : World; float4x4 viewProjection : ViewProjection; texture colorTexture < string ResourceName = "default_color.dds"; string UIName = "Diffuse Texture"; string ResourceType = "2D"; >; sampler2D colorSampler = sampler_state { Texture = <colorTexture>; generateMipMap = true; MinFilter = LinearMipMapLinear; MagFilter = Linear; WrapS = Repeat; WrapT = Repeat; }; technique basic_textured_dx_40 { pass { FragmentProgram = compile ps_2_0 mainFS(colorSampler); VertexProgram = compile vs_2_0 mainVS(viewProjection, world); DepthTestEnable = true; DepthMask = true; } } technique basic_textured_ogl_40 { pass { FragmentProgram = compile fp40 mainFS(colorSampler); VertexProgram = compile vp40 mainVS(viewProjection, world); DepthTestEnable = true; DepthMask = true; } } 

##### Share on other sites
I've just come across the exact same problem myself... did you solve it?

##### Share on other sites
Maybe this is because DX and OpenGL use different coordinate systems? If this is the case try to change [color=#000000][size=2]

 [color=#000000][size=2]oPosition [color=#666600][size=2]=[color=#000000][size=2] mul[color=#666600][size=2]([color=#000000][size=2]world[color=#666600][size=2],[color=#000000][size=2] position[color=#666600][size=2]); [color=#000000][size=2]oPosition [color=#666600][size=2]=[color=#000000][size=2] mul[color=#666600][size=2]([color=#000000][size=2]viewProjection[color=#666600][size=2],[color=#000000][size=2] oPosition[color=#666600][size=2]); 

to

 [color=#000000][size=2]oPosition [color=#666600][size=2]=[color=#000000][size=2] mul[color=#666600][size=2]([color=#000000][size=2]position[color=#666600][size=2],[color=#000000][size=2] world[color=#666600][size=2]); [color=#000000][size=2]oPosition [color=#666600][size=2]=[color=#000000][size=2] mul[color=#666600][size=2]([color=#000000][size=2]oPosition[color=#666600][size=2],[color=#000000][size=2] viewProjection[color=#666600][size=2]); 

##### Share on other sites
Sry for that... just tried to copy the code from the shader code.
In short:

change the order of the parameters in the calls to "mul"

##### Share on other sites
I posted the question on Stack Overflow and it doesn't seem like anyone has an answer for it there either.

I've done a lot of investigations and tried many different things, and the bottom line I think is that our hardware doesn't support certain profiles.

For example for Direct3D 10 you need shader model 4 it seems. However when I tried changing the profiles of the effect from vs_3_0/ps_3_0 to vs_4_0/ps_4_0, I got an error that my hardware doesn't support it.

I also found a forum thread on nvidia's site where a member of nvidia's staff mentioned something along the lines of FX Composer not supporting cgfx with Direct3D. I've also come across multiple forum posts all over the web (very old mostly) talking about cg dead/dying/will die, nvidia not supporting it and so on.

Also note the FX Composer FAQ, scroll down and you'll find

[indent=1]

[indent=1]

### A: "We are always evaluating opportunites to provide powerful tools for developers, but have no plans to add support for other languages to FX Composer. FX Composer was built to support the large number of developers using HLSL in their applications."

So basically, I think the bottom line is this:

• Some of the problems we are seeing are related to the hardware capabilities (or lack of them).
• Some of the problems are related to restrictions of FX Composer.

For me since my objective is purely to learn shaders in general, the solution was to stick to HLSL and Direct3D 9. I will verify my suspicion about DirectX 10 when I have access to a newer card on another machine that I have.

There is also an interesting (old) forum thread here on gamedev: http://www.gamedev.net/topic/281349-hlsl-vs-cg-any-significant-difference/

##### Share on other sites
OK I take it back in regards to DirectX 10, I managed to get it to work on the HLSL/.fx side (not Cg/.cgfx).

It seems that the .fx templates that FX Composer generates by default only provide a DirectX 9 technique. With DirectX 10, you need to use the technique10 keyword instead of technique. The technique10 keyword has different syntax. Where previously it looked like this:
 technique technique1 { pass p0 { VertexShader = compile vs_3_0 mainVS(); PixelShader = compile ps_3_0 mainPS(); } } 

With DirectX 10 it should look like this:
 technique10 technique_dx10 { pass p0 { SetVertexShader( CompileShader( vs_4_0, mainVS() ) ); SetPixelShader( CompileShader( ps_4_0, mainPS() ) ); } } 

With this your effect will work both on DirectX 9 and DirectX 10. It's a shame nVidia didn't make FX Composer generate both to begin with.

You can find the various bits and pieces of the technique10 syntax online (mainly on microsoft's website). Edited by amirabiri