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 8743379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:39:55+00:00 2026-06-13T11:39:55+00:00

I am trying get 3 new random floats into my pixel shader for each

  • 0

I am trying get 3 new random floats into my pixel shader for each pixel. Based on what I have read here, here, and also here, I believe that I need to generate a large texture containing random RGB values and then during each draw call randomly generate a couple of texture coordinate offset values to produce a pseudo-random effect. Is the only way to do this through the LockRect and UnlockRect API? I hope not.

  • 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-06-13T11:39:57+00:00Added an answer on June 13, 2026 at 11:39 am

    They only way I have found to do this is the lock and unlock rectangle method. But it is much easier then I initially thought. Here is how I filled the texture.
    ‘Create Random texture for dithering shader
    rando = New Random()
    randomText = New Texture(device, 1000, 1000, 1, Usage.Dynamic,
    Format.A16B16G16R16, Pool.Default)
    ‘89599
    ‘89510
    Dim data(1000 * 1000 * 8 + 1000 * 63 + 936) As Byte
    rando.NextBytes(data)

        Dim dataBox As DataRectangle =
    randomText.GetSurfaceLevel(0).LockRectangle(LockFlags.None)
        dataBox.Data.Seek(0, IO.SeekOrigin.Begin)
        dataBox.Data.Write(data, 0, data.Length)
        dataBox.Data.Close()
    

    As you can see from the code I had to add a lot of extra bytes to completely fill the texture with random values. I used a 1000 x 1000 64bit texture so you would think I would need 1000*1000*8 Bytes of data but I need an extra 63936 Bytes to fill the texture and I am not sure why. But it seems to work for my needs.

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

Sidebar

Related Questions

I'm new to PHP and trying to get my head around security. I have
Trying to get this code off the ground: Random random = new Random(); public
I am trying to get the new PDO driver running in Code Igniter 2.1.1
I'm trying to get a new Enterprise Application Project set up in Eclipse using
I am trying to get a new dynamically created row to add to a
I'm trying to get the new ASP.NET Web API beta (VS 2010 default Web
So, I am trying to get my new pane on the Ubercart Checkout page
I am new to hadoop and trying to get a single node setup of
Im new to Rapahel and im trying to get the position of an element
I am new to using RavenDB and trying to get indexes to work in

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.