Q1: How to contruction a samplerCUBE in .fx file
1. I import my static cubemap texture into content pipeline
TextureCube mySkybox;
2. In LoadGraphicsContent()
mySkybox = content.Load<TextureCube>("Contents\\skybox");
and now everything is ok.
The question is how can I contruct a samplerCUBE in myEffect.fx file
Q2: How to create a dynamic cubemap
Q3: How can I setup VC# express so that I can have HLSL language higt light when I edit *.fx in VC#

How can I pass Cubemap texture into Pixal Shader ?
Jamie Thomson
For a good tutorial on environment mapping and HLSL, see the following:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/directx9_c/Goal_3___Environment_Mapping.asp
We don't have support for Effect or HLSL syntax highlighting in v1. This is something we're looking at providing in a future version.
Beast Forever
OK,
I recreated the cube map so that it was of 1280X1024 and saved it as a DXT5 format and still got the same error, but I noticed that the stock cube map that FX Composer uses has Mip Maps (what ever the hell they are) and my cube didnt, so I decided to Generate Mip Maps from the DirectX Texture Tool, and it built 11 just like the stock dds has.
I now get a compile error:
Error 1 Building content threw ArgumentException: The sourceData array has length 64, but bitmap pixel data size should be 144.
at Microsoft.Xna.Framework.Content.Pipeline.Graphics.DxtBitmapContent.SetPixelData(Byte[] sourceData)
at Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.CreateAndFillBitmapContent(_D3DLOCKED_RECT lockedRect, _D3DSURFACE_DESC surfaceDescription, ContentIdentity contentIdentity)
at Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.ImportCubeTexture(Char* wFilename, _D3DXIMAGE_INFO* imageInfo, ContentIdentity contentIdentity)
at Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.Import(String filename, ContentImporterContext context)
at Microsoft.Xna.Framework.Content.Pipeline.ContentImporter`1.Microsoft.Xna.Framework.Content.Pipeline.IContentImporter.Import(String filename, ContentImporterContext context)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAssetDirectly(BuildItem item, String importerName)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAsset(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.RunTheBuild()
at Microsoft.Xna.Framework.Content.Pipeline.Tasks.BuildContent.RemoteProxy.RunTheBuild(BuildCoordinatorSettings settings, ITaskItem[] sourceAssets, TaskLoggingHelper msbuildLog, String[]& outputContent, String[]& rebuiltContent, String[]& intermediates) C:\Development\XNA\Projects\Randomchaos3DEngine\EngineDemo\Content\Textures\SkyBox\HazyMind\cubeMap.dds EngineDemo
I am getting the above error when I compile now with mip maps and if I use a cube that does not hap them I get an exception as I have described in a previous post on ths thread.
Where am I going wrong......
parreg
GazNewt
How can I tell if my cubemap is power of two, in fact what does it mean to have a power of two cube map, and how do you make a cube map power of two.
I have found that my cube map loads fine in the FX Composer, it is just when loading it in XNA that it has problems.
Barguast
I am trying to use a glass shader for one of my objects and when I try and load the Cube asset I get a System.InvalidOperation exception with the message "The method call is invalid."
I am trying to load the cube map asset like this:
TextureCube myCube;
myCube = myLoader.Load<TextureCube>("Content/Textures/SkyBox/HazyMind/cubeMap");
Where cubeMap is a dds file (converted to xnb at compile time)
The stack trace looks like this:
at Microsoft.Xna.Framework.Graphics.TextureCube.CreateTexture(GraphicsDevice graphicsDevice, Int32 edgeLength, Int32 numberLevels, ResourceUsage usage, SurfaceFormat format, ResourceManagementMode resourceManagementMode)
at Microsoft.Xna.Framework.Graphics.TextureCube..ctor(GraphicsDevice graphicsDevice, Int32 edgeLength, Int32 numberLevels, ResourceUsage usage, SurfaceFormat format, ResourceManagementMode resourceManagementMode)
at Microsoft.Xna.Framework.Content.TextureCubeReader.Read(ContentReader input, TextureCube existingInstance)
at Microsoft.Xna.Framework.Content.ContentReader.InvokeReader[T](ContentTypeReader reader, Object existingInstance)
at Microsoft.Xna.Framework.Content.ContentReader.ReadObjectInternal[T](Object existingInstance)
at Microsoft.Xna.Framework.Content.ContentReader.ReadObject[T]()
at Microsoft.Xna.Framework.Content.ContentReader.ReadAsset[T]()
at Microsoft.Xna.Framework.Content.ContentManager.Load[T](String assetName)
at Randomchaos3DEngine.RCShaders.RCShader.LoadGraphicsContent(ContentManager myLoader) in C:\Development\XNA\Projects\Randomchaos3DEngine\Randomchaos3DEngine\RCShader.cs:line 68
at Randomchaos3DEngine.RCShaders.RCShaderManager.LoadGraphicsContent(ContentManager myLoader) in C:\Development\XNA\Projects\Randomchaos3DEngine\Randomchaos3DEngine\RCShader.cs:line 36
at Randomchaos3DEngine.RCGame.LoadGraphicsContent(Boolean loadAllContent) in C:\Development\XNA\Projects\Randomchaos3DEngine\Randomchaos3DEngine\RCGame.cs:line 162
at Microsoft.Xna.Framework.Game.Initialize()
at Randomchaos3DEngine.RCGame.Initialize() in C:\Development\XNA\Projects\Randomchaos3DEngine\Randomchaos3DEngine\RCGame.cs:line 193
at Microsoft.Xna.Framework.Game.Run()
at EngineDemo.EngineDemo.Main() in C:\Development\XNA\Projects\Randomchaos3DEngine\EngineDemo\EngineDemo.cs:line 26
Do I need to create an instance of TexureCube first
Urlik
Shawn,
First off, thanks for the reply.
My cube map is 1800X1800 and I think the format is (please remember I ma new to this) X8R8G8B8. I generated it with the DirectX Texture Tool.
How do I know what cube map formats are valid for my graphics card
What would be the lowest common denominator format for a cube ap
Ronald Schilf
I'm guessing it is in a format that's not supported by your graphics card.
MarcMe
LOL,
1024 loads :) Thank you, that was painful, sorry to be slow on the uptake and thanks for your time.
All I have to do is get the shader working now all I am getting at the moment is a black shaddow of the mesh and no effect at all.... :(
Thanks again.
Eduardo Coelho
Very few graphics cards support cubemaps that are not powers of two. Try resizing your texture to 1024 or 2048 (which are powers of two).
grprk
Most likely the problem is that your cubemap is not a power of two.
manjunath.sarla
Photab