Using 16-Bit textures - visual-studio-2010

WP7 textures are supported in the Reach-Profile that WP7 devices falls into.
But XNA converts all my ressources upon adding them to a project to RGBA8, that's insane,
the displays of WP7 devices are 16 Bit!
Information: WP7 SDK 7.1 (XNA 4), Visual Studio 2010
Question part 1: How can I add a RGB565 texture to a XNA project and what is the correct way to load them inside a game?
Question part 2: Is there a reasonable 16 Bit texture format (within Reach) that supports alpha with MORE than 1Bit?
Question part 3: Is the normal rendertarget (I think that's what the screenbuffer is?) already 16 bit?

Part 1:
change surfaceformat like
graphics.PreferredBackBufferFormat = SurfaceFormat.Color;
(XNA) OR (in Silverlight/XNA Project)
SharedGraphicsDeviceManager.Current.PreferredBackBufferFormat = SurfaceFormat.Color; //supports 32bit ARGB each color 8bit
Part 2:
PNG should work... it supports 8bit (256) and 16Bit alpha channel(65.536 possibilities)

Related

tvOS Icon-Set template

For a tvOS app I am trying to set up the App Icon. First xCode complained about the size and now about the image's alpha.
/var/folders/fc/s3m4kgtn2gs977m4k8x2s2xm0000gn/T/Large-AppIcon-Scratch-4AC4A1D7-D8F5-4D58-8667-A11E4F2DE7DA.xcassets:
The last image stack layer with content, "Back", must be a fully
opaque bitmap. The pixel at position (0, 0) has an alpha value of 212.
Are there any easy instructions, tools, or templates which can be used to create a proper App Icon & Top Shelf Image.brandassets ?
(without Photoshop CC!)
Bohemian Coding's Sketch is a great tool to use. If you don't want to spend $100, you can simply use a program like Paint.
For the small icon, each layer should be 659x371.
For the large icon, each layer should be 1977x1113. (3x the size of the small icon).
The bottom layer cannot have any transparency, but the top two need to have transparency.
Also be sure to leave plenty of buffer room around the outside of your icon.
I was dealing with this issue for a while. Finally it dawned on my that Layer 0 can have transparency but Layer 1 cant. With that said, I thought Layer 0 would of been the background and Layer 1 in the foreground, but its the opposite. Layer 0 is the closest to you, if that makes sense.
Instructions can be found in the Apple TV Human Interface Guidelines. There is also a link to download resource templates including templates for both app icons and the topshelf image.
If you provide an opaque back layer for the app icons then your problem should disappear.
You can use any tool of choice, preferably one that is able to import .psd files (the templates are in .psd format). Personally I use Pixelmator. AFAIK GIMP also supports importing .psd files.

Antialiased lines using jogl on Windows 7 look horrible

My java application uses jogl to create surfaces with an overlaid grid. The lines of the grid are anti-aliased. However, on Windows the anti-aliasing is complete garbage, unless I add a small alpha value to the surface. Here are screen shots of the same scene on all three platforms:
Mac OS X:
Ubuntu 11.10:
Windows 7:
Windows 7 with alpha=0.01:
The basic procedure to create this is as follows:
gl.glPushAttrib( GL.GL_ALL_ATTRIB_BITS );
gl.glEnable(GL.GL_POLYGON_OFFSET_FILL);
gl.glPolygonOffset(1.0f, 1.0f);
drawSurface(gl);
gl.glDisable(GL.GL_POLYGON_OFFSET_FILL);
gl.glPopAttrib();
gl.glDisable( GL.GL_LIGHTING );
gl.glDepthFunc(GL.GL_LEQUAL);
float[] c = {0, 0, 0, 0.5f};
gl.glColor4fv(c, 0);//the alpha here gets overridden if one is specified for the surface (which is why the Windows-with-alpha produces a darker grid)
drawGrid(gl);
gl.glDepthFunc(GL.GL_LESS);
gl.glEnable( GL.GL_LIGHTING );
The drawSurface() method also does the following before creating the polygons for the surface (using GL_TRIANGLE_STRIP primitives):
gl.glPushAttrib(GL.GL_LIGHTING_BIT);
gl.glColorMaterial(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT_AND_DIFFUSE);
gl.glEnable(GL.GL_COLOR_MATERIAL);
The drawGrid() method sets up anti-aliasing like so:
gl.glEnable(GL.GL_BLEND);
gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
gl.glEnable(GL.GL_LINE_SMOOTH);
gl.glHint(GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST);
The grid itself is created using GL_LINE_STRIPs
I've read up on the OpenGL documentation regarding line anti-aliasing and also tried out the polygon offset example here.
As for hardware, I have dual boot IBM ThinkPad (64-bit quad core) with an integrated nVidia 3100M card and an Intel Core 2 Duo iMac which has an ATI Radeon. Since Ubuntu and Windows are running on the same hardware, I know it can't be a hardware issue.
I'm looking for suggestions for improving the anti-aliasing of the grid lines on Windows.
Turns out I had not tried (I thought I had, but I did not rebuild and test it correctly)
gl.glDepthMask( false );
Adding that in correctly did greatly improve the fragmentation of the anti-aliased lines of the grid.
That said, I'm still not 100% happy with the look of the lines, but, for now, this question is resolved. Here is a screen shot of the 'improved' grid lines:
While this is a great improvement, it's still not as good as Mac OS X or even Ubuntu.

WP7 - Splash Screen doesn't display correctly on launch

What I'm trying to do:
I've added a splash screen to an application I'm creating for Windows Phone 7. I did this simply by replacing the pre-existing splash screen file with my own.
What goes wrong:
The splash screen is not displayed like it should be - it is being down sampled to an 8 bit image or something weird:
-
The image I'm using
-
The image that gets displayed
It's a bit hard to see depending on your monitor, but on a phone it's reasonably obvious. There are fuzzy greenish lines that appear - basically like the image is being down sampled or the quality worsened.
Any idea what I'm doing wrong, or what might be happening?
Thanks.
Try forcing the app to display images at 32 bits per pixel (instead of the default of 16)
Add an attribute of BitsPerPixel="32" to the app element in WMAppManifest.xml
See http://forums.create.msdn.com/forums/p/85960/520394.aspx#520394
The problem is that the gradient on your splash screen is causing banding, which you can solve by dithering. Robby Ingebretsen has an action for PhotoShop that you can use: http://nerdplusart.com/photoshop-action-for-windows-phone-7-dithering
I suspect the emulator. Run the emulator at full size or run the app on an actual device.
Windows Phone is currently only supporting a color depth of 16bit, causing especially some gradients displaying downsampled for 24bit images. Some first generation firmwares by HTC had a "bug" that also allowed 24bit. Theoretically it is just a registry key, but you cannot commonly change it. Microsoft has limited the color depth to 16bit for the benefit of performance, but as far as I knnow there are some second-generation models without this limitation now.
You may try to downsample the image in Photoshop to 16bit and optimize it for this color depth.

Setting up OpenGL/Cuda interop in Windows

I am writing a DLL that needs to do some work in Cuda 3.2 and some work in OpenGL. OpenGL will render some grayscale images that my Cuda code needs to read in and modify, and then give back to OpenGL as a texture. I believe I need to create PBOs to do that. I have done some basic OpenGL stuff before but never worked with extensions, and that's where my problem is - I've been searching for 2 days and so far haven't been able to find a working example, despite wading through pages and pages of code. None of the samples I've tried work (and I'm sure my vid card will support it, being a GTX470)
Some specific questions:
1. I installed the nvidia opengl sdk. Should I be using glew.h and wglew.h to access the extensions?
2. My DLL does not have any UI - do I need to create a hidden window or is there an easier way to create an off-screen rendering context?
3. Can I create a grayscale PBO by using GL_RED_8UI format? Will both cuda and gl be happy with that? I read the opengl interop section in the cuda programming manual and it said GL_RGBA_8UI was only usable by pixel shaders because it was an OpenGL 3.0 feature, but I didn't know if that applied to a 1-channel format. 1 channel float would also work for my purposes.
4. I thought this would be fairly easy to do - does it really require hundreds of lines of code?
Edit:
I have code to create an OpenGL context attached to a HBITMAP. Should I create a bitmap-rendering context and then try to attach a PBO to that? Or will that slow me down by also rendering to CPU memory? Is it better to create an invisible window and attach the PBO to that? Also, does the pixel format of my PBO have to match the window/bitmap? What about the dimensions?
Thanks,
Alex
There's actually an example of how to use OpenGL and CUDA together. Look at the SimpleGL example.
You may want to take a look at this example:
https://github.com/nvpro-samples/gl_cuda_interop_pingpong_st

How to install Tom's Terrain Tool for the Unity Game Engine?

I just bought and downloaded Tom's Terrain Tool but I can't find instructions for how to install it. I've looked in the downloaded file - it's a compiled file. I've looked on his website and only find instructions for what to do after it's installed. I've googled around for instructions and can't find them anywhere. In fact, the only file I got with the download is a gzip that extracts into TTT.file. Is that the only thing that was supposed to come with the tool? Why isn't there a readme file with it? Can anyone help me out here? Thanks.
From the installation instructions here:
Created a new terrain
1) Imported a heightmap
2) Calculated the light map
3) Imported all the splatmaps, treemaps, etc. you wish to use into Unity as RGB 24bit textures.
4) If using Unity 2.6, all the textures/maps you intend to use must be set to "readable" in the import settings.
5) If using Unity 3, all the textures/maps must have their Texture Type set to "Advanced" and then checked the "Read/Write
enabled" option.
Once you're installed the Terrain Tools, you will find them in Terrain
=> Tom's Terrain Tools in the Unity editor.
RoyS describes this process in his post here:
Here's the steps I use to get my terrain into Unity.
1 - Generate your L3DT map via the Wizard if you're unfamiliar with
it. Then... File-->Export map-->(select) Heightfield File format -
(pulldown) select "RAW"
-type in a File Name
-check "resize for export"
-1025 size (default) Operations-->Alpha Map-->Alpha Express (png)
The raw is your heightmap and the png is your splatmap. Move those to
your Assets folder.
2 - Make sure "Tom's Terrain Tools" is installed per his instructions.
3 - In Unity Terrain-->Create Terrain Add your 4 textures in Unity as
normal (you can get some nice terrain textures from
http://cgtextures.com ) Terrain-->Import Heightmap RAW
--Bit16
--Windows
Now you should see your heightmap in your first colour chosen. If the
mountains are too high, then go Terrain-->Set Resolution and change
the 600 value. Just change those numbers until you get the desired
height of your mountains and valleys.
Now for the rest of the colour of your terrain.
In Unity, select your png texture in the Project folder and in
Inspector change it to ARGB 32 bit and hit the Apply button. Now you
won't get an error message to change it to 32 bit RBGA as you've just
done it. Now to add the splatmap...
Terrain-->Tom's Terrain Tools-->Splatmap
If you're sand is in your mountain area and your grass under the sea,
then just change the order of your textures until it's right (ie, the
terrain paintbrush textures as if you were painting one from scratch -
the same ones you loaded above).

Resources