Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7516227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:03:58+00:00 2026-05-30T01:03:58+00:00

I want to know how to remove part of a Texture from a Texture2D.

  • 0

I want to know how to remove part of a Texture from a Texture2D.
I have a simple game in which I want to blow up a planet piece by piece, when a bullet hits it “digs” into the planet.

The physics are already working but I am stuck on how to cut the texture properly.

I need to create a function that takes a Texture2D a position and a radius as input and returns the new Texture2D.

Here is an example of the Texture2D before and after what I want to accomplish.
http://img513.imageshack.us/img513/6749/redplanet512examplesmal.png

Also note that i drew a thin brown border around the crater hole. If this is possible it would be a great bonus.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:03:59+00:00Added an answer on May 30, 2026 at 1:03 am

    After doing alot of googling on the subject it seems the best and fastest way to achieve the effect i want is to use pixel shaders.

    More specifically a shader method called ‘Alpha mapping’. Alpha mapping is done by using the original texture and another greyscale texture that defines what parts are visible or not.

    The idea of the shader is to go through each pixel in the original texture and check how black each pixel in the greyscale image is at the same coordinate. The blacker the pixel in the greyscale picture is the higher the alpha value (more visible) the pixel in the original texture becomes. Since all this is done on the GPU it is lightning fast and leaves the CPU ready to do the actual logic for the game.

    For my example I will create a black image to use as my greyscale image and then draw white circles on this corresponding to the parts i want to remove.

    I’ve found a MSDN examples with working source code for XNA 4 that does this (the cat example):

    http://create.msdn.com/en-US/education/catalog/sample/sprite_effects

    EDIT:
    I got this to work quite nicely. Created a small tutorial with source code here: http://syntaxwarriors.com/2012/xna-alpha-mapping-with-pixel-shaders/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have NSArray and I want to remove duplicates from it. I know that
I want to know is there any way that I can remove duplicates from
I want to remove an item from ListView , but I don't know how
i want to remove a particular #keyword from a string. i dont know its
i want to know how to remove underline in display listview in android, can
Please can any ove suggest me how i can remove time part from sql
I want to know how do I go about removing individual delegates from the
i want to have function like delete file from database by using link instead
Possible Duplicate: How to remove parts in a URL? I want to know how
From an optimization standpoint, I want to know when it's best to SELECT some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.