Jump to content
  • Advertisement

Wessam Bahnassi

  • Content count

  • Joined

  • Last visited

Community Reputation

164 Neutral

About Wessam Bahnassi

  • Rank

Personal Information


  • Twitter
  1. Wessam Bahnassi

    Bitblitting with transparency

    One more idea to add is RLE-style memcpys/skips for 1-bit transparency. Depending on the transparency pattern in the sprite, this can either be very fast or more taxing (e.g. dithered transparency will be the worst case).
  2. Wessam Bahnassi

    Bitblitting with transparency

    MemCpy can't help here. But that routine is still useful for cases where you know transparency is not required (e.g. the user disables transparency on the sprite). For transparent sprites, a 1-bit transparency could be done fast by replacing the overwrite with AND/OR and a mask generated from the transparent bit in the sprite. Prototype it in regular C code, then rewrite it with intrinsics (get inspired from how memcpy or memset are implemented) to make things a tad faster. If the memory you're writing to is write-combined (e.g. some display buffer) then be careful to write continuously. The worst thing to do is an if-statement that skips writing to the target location for transparent pixels. But I must also mention that such memory types are not usually primed for reads, so it is generally a bad idea to do any pixel blending on such memory.
  3. Setting the Width/Height of the Window will not guarantee you a certain required client area. To guarantee that, you have to do it by relying on an element within the window to act as your client area, and have the window size to that element. In the example below I used a top-level Grid element. You can see how the actual widths and heights of both the window and client area element are. Note the SizeToContent attribute on the Window. <Window x:Class="WpfApp1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" SizeToContent="WidthAndHeight" x:Name="window"> <Grid x:Name="clientArea" Width="1200" Height="900"> <StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="ActualWidth: " /> <TextBlock Text="{Binding ActualWidth, ElementName=window}" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="ActualHeight: " /> <TextBlock Text="{Binding ActualHeight, ElementName=window}" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="ClientWidth: " /> <TextBlock Text="{Binding ActualWidth, ElementName=clientArea}" /> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="ClientHeight: " /> <TextBlock Text="{Binding ActualHeight, ElementName=clientArea}" /> </StackPanel> </StackPanel> </Grid> </Window>
  4. Hmm. That's weird. One suggestion is to set all MinWidth and MaxWidth and Width to the value you want (i.e. 1200) and the same for height. Is your desire is to get 1200x900 client area or total window area (i.e. including any decorations)?
  5. Wessam Bahnassi

    How to mipmap procedural shaders?

      Anti-aliasing in terms of today's APIs works on geometry edges not on shading.       Yup, that's closer to a sensible approach. du/dv tells you the frequency you're being sampled at... so theoretically you do "multisampling" at higher frequencies and average the results. But I want to know if anyone has smarter/faster ideas than this...
  6. A general observation for shaders that rely on procedural functions f(u,v) to generate colors is that such shaders may alias so hard at the distance. For example, if f(u,v) generates periodic lines on u and v then on distant surfaces those lines alias strongly (see attachment). If we replace the procedural function with a mipmapped texture lookup then the result improves a lot. So my question is, is there a generic way to make a function f(u,v) "mipmap" in a pixel shader aside from the texture approach?    
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!