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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:21:36+00:00 2026-05-12T09:21:36+00:00

Hello I got goal to achieve, 3d cube manipulated with mouse with gradient filling

  • 0

Hello I got goal to achieve, 3d cube manipulated with mouse with gradient filling on each wall.

I found some source codes coresponding to gradients and 3d rotating cube but here is the problem:

When i put these two things together the effect looks like the cube was a wireframe with transparency to some gradient background hidden behind the first plane solid black background. Gradient always stays still.

Method which rotates/displays cube got at input three parameters rotx .roty, rotz i’d like to make use of it and apply it to gradients displayed on each side. gradient got own matrix but i don’t have a clue how and when manipulate this gradient to get desired effect – i mean transform/rotate gradient in way ro look like it is painted on side of cube and tranform along to it 3d position. I guess that each side should have separate gradient matrix dor each side but what to do to transform this matrix to fit along with rotx,roty, i rotz. Can anyone help me?

here is source for gradient
http://snipplr.com/view.php?codeview&id=7050

and site where you can get cube fla file
http://www.flashandmath.com/flashcs4/cs4simple3d/index.html

and here is code of .fla file from link above with my modifications

http://pastebin.com/fdc431a4

  • 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-12T09:21:36+00:00Added an answer on May 12, 2026 at 9:21 am

    this is not really possible … perspective distortion is not an affine transformation, which is why there is not matrix that’d be a suitable parameter to create a gradient with the correct perspective distortion …

    i think the most simple way for flash 10 is to actually go a different way … all DisplayObjects can be transformed in space, so you simply represent any face by a DisplayObject, perform all transformations on it, and then all that is left to do is z-sorting …


    edit: the approximation you are looking for is quite impossible … imagine a cube, facing you, having a linear gradient from black to white, from the top to the bottom … as you start turning it right, the lines of the gradient no longer stay parallel, instead they start forming a conical gradient, all converging in one point …

    the approach in the 2nd paragraph is exactly what you are looking for … create a DisplayObject (Shape should do it, you don’t need MovieClips for that), draw a gradient to it, and then transform it in 3d space using x, y, z, rotationX, rotationY and rotationZ … and as soon as you use more than one object, you will need to manually z-sort them … if you want 3d-gradients, you will have to drop that code and use this approach, which is by far the most simple …

    your problems with AS3 really doesn’t have anything to do with the language … you should reconsider your approach … starting with a new language and an unknown API, trying to enhance a 3d-engine without having knowledge of the theory behind, is not really the best thing to do …

    you should start getting used to the language first … once you feel comfortable with it, i think the best way to go for you is using a good AS3 3d engine, such as sandy, papervision, away3d, alternativa or whatever … for example with sandy, you create a sky box (a 3d cube) and assign any materials you want to it’s faces and you’re done … and also, these engines interoperate with 3d modeling software, so instead of just creating some polyhedrons by hand and playing around with them, you can import complex model and do some pretty cool stuff … but do things in logical order and with sufficient theoretical knowledge …

    good luck then … 😉


    greetz

    back2dos

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

Sidebar

Related Questions

Hello folks, I've got the issue to add a browser event to some input
Hello there i got some code here; <script type=text/javascript> $(function(){ var playListURL = 'http://gdata.youtube.com/feeds/api/playlists/8BCDD04DE8F771B2?v=2&alt=json&callback=?';
Hello i got some method that generating where statment programmatically how can i move
I got hello world text to print after I hardcoded some html right into
relative(?) links: http://api.jquery.com/each/ http://api.jquery.com/jQuery.each/ hello i got this navigation menu <table> <tr> <td><div id=menuItem1
Hello I got some stored procedures to create products and other stuff on my
Hello I've got a loop that adds some drop down items to a Tool
Hello got the error in following code.. The method RefeshDataGridView() is static.I run it
Hello I've got this query to get users by email, which is an unique
I got this code ` // // prints out Hello World! // hello_world(); //First

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.