Jump to content

mkultra333

Member
  • Posts

    17
  • Joined

  • Last visited

Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Gah! Just as well, I think the above is wrong too... hehe, I'll get back to you. P.S. Don't worry, I'm not pressuring for this to be included soon, or even at all. Just posting it in case you think it's interesting and it saves you some time. Edit: I see what was throwing me. Light::Rotate gets called multiple times for a single light rotation, so the flip/swaps were being applied multiple times. That, plus the difference between _lightTarget and _lightTargetTransformed. Now I change _lightTargetTransformed instead, and only apply the projections at the bottom if the rotation hasn't already been achieved using flip/swaps. If I do that, the second version of the rotation flips/swaps is correct.
  2. Ah, today I realized the swaps/flips I gave are wrong, they work the first 90 degree rotation but then "undo" themselves on the second. Heres the correct code: #define BZN_ROTEPSILON 0.000001 void Light::rotate(const Quaternion& rotation) { if (isProjected()) { Quaternion NewRotation = rotation; if( // X Axis 90 degree rotation (rotation.w()>-0.707107-BZN_ROTEPSILON) && (rotation.w()<-0.707107+BZN_ROTEPSILON) && (rotation.x()>-0.707107-BZN_ROTEPSILON) && (rotation.x()<-0.707107+BZN_ROTEPSILON) && (rotation.y()>0.0-BZN_ROTEPSILON) && (rotation.y()<0.0+BZN_ROTEPSILON) && (rotation.z()>0.0-BZN_ROTEPSILON) && (rotation.z()<0.0+BZN_ROTEPSILON) ) { Vector3 LTarget; LTarget=Vector3(_lightTarget.x(), _lightTarget.z(), -_lightTarget.y()); _lightTarget=LTarget; LTarget=Vector3(_lightRight.x(), _lightRight.z(), -_lightRight.y()); _lightRight=LTarget; LTarget=Vector3(_lightUp.x(), _lightUp.z(), -_lightUp.y()); _lightUp=LTarget; LTarget=Vector3(_lightStart.x(), _lightStart.z(), -_lightStart.y()); _lightStart=LTarget; LTarget=Vector3(_lightEnd.x(), _lightEnd.z(), -_lightEnd.y()); _lightEnd=LTarget; NewRotation=Quaternion(1.0, 0, 0, 0); } if( // Y Axis 90 degree rotation (rotation.w()>0.707107-BZN_ROTEPSILON) && (rotation.w()<0.707107+BZN_ROTEPSILON) && (rotation.x()>0.0-BZN_ROTEPSILON) && (rotation.x()<0.0+BZN_ROTEPSILON) && (rotation.y()>0.707107-BZN_ROTEPSILON) && (rotation.y()<0.707107+BZN_ROTEPSILON) && (rotation.z()>0.0-BZN_ROTEPSILON) && (rotation.z()<0.0+BZN_ROTEPSILON) ) { Vector3 LTarget; LTarget=Vector3(_lightTarget.z(), _lightTarget.y(), -_lightTarget.x()); _lightTarget=LTarget; LTarget=Vector3(_lightRight.z(), _lightRight.y(), -_lightRight.x()); _lightRight=LTarget; LTarget=Vector3(_lightUp.z(), _lightUp.y(), -_lightUp.x()); _lightUp=LTarget; LTarget=Vector3(_lightStart.z(), _lightStart.y(), -_lightStart.x()); _lightStart=LTarget; LTarget=Vector3(_lightEnd.z(), _lightEnd.y(), -_lightEnd.x()); _lightEnd=LTarget; NewRotation=Quaternion(1.0, 0, 0, 0); } if( // Z Axis 90 degree rotation (rotation.w()>-0.707107-BZN_ROTEPSILON) && (rotation.w()<-0.707107+BZN_ROTEPSILON) && (rotation.x()>0.0-BZN_ROTEPSILON) && (rotation.x()<0.0+BZN_ROTEPSILON) && (rotation.y()>0.0-BZN_ROTEPSILON) && (rotation.y()<0.0+BZN_ROTEPSILON) && (rotation.z()>-0.707107-BZN_ROTEPSILON) && (rotation.z()<-0.707107+BZN_ROTEPSILON) ) { Vector3 LTarget; LTarget=Vector3(_lightTarget.y(), -_lightTarget.x(), _lightTarget.z()); _lightTarget=LTarget; LTarget=Vector3(_lightRight.y(), -_lightRight.x(), _lightRight.z()); _lightRight=LTarget; LTarget=Vector3(_lightUp.y(), -_lightUp.x(), _lightUp.z()); _lightUp=LTarget; LTarget=Vector3(_lightStart.y(), -_lightStart.x(), _lightStart.z()); _lightStart=LTarget; LTarget=Vector3(_lightEnd.y(), -_lightEnd.x(), _lightEnd.z()); _lightEnd=LTarget; NewRotation=Quaternion(1.0, 0, 0, 0); } // Retrieve the rotation matrix... Matrix4 rotationMatrix = matrix4_rotation_for_quaternion(NewRotation); // ... and apply it to all the vertices defining the projection _lightTargetTransformed = rotationMatrix.transform(_lightTarget).getProjected(); _lightRightTransformed = rotationMatrix.transform(_lightRight).getProjected(); _lightUpTransformed = rotationMatrix.transform(_lightUp).getProjected(); _lightStartTransformed = rotationMatrix.transform(_lightStart).getProjected(); _lightEndTransformed = rotationMatrix.transform(_lightEnd).getProjected(); } else { m_rotation.rotate(rotation); } }
  3. That is very interesting. XreaLRadiant plus XMap2 could be close to what I need afterall. I'm already using a modified Q3Map2, so it might not be that hard to get XMap2 functioning in my project.
  4. Here's the setup spotlight, it's at an angle to make later problems more noticable, but it'll happen for axial directions too. Now I rotate it 90 degrees around the x (I used the button this time, but the menu option does the same). The light draws ok, but notice the lighting keys, they have things like "4.38125e-006" in them, scientific notation. While this works ok, it's still slightly innaccurate. Probably not a big issue, especially for TDM mappers, but it needed to be changed for my project and the method I suggested gets rid of it. The issue with mirroring is more of a problem. Here's the same original light, only now it's part of a small scene. I flip the scene about the x axis via the button (menu does the same) and this is the result. With just the light selected, we see the keys. Part of the problem is that light_target really needs it's x value to be flipped, it should be -256. I have got flipping working now, via my own crude methods. I added the following function. // bzn mirroring for projected lights // check if the scale is a type of mirroring, if so flip the necessary values void Light::mirror(const Vector3& scale) { if (isProjected()) { if((scale.x()==-1.0) && (scale.y()==1.0) && (scale.z()==1.0)) { Vector3 LTarget; LTarget=Vector3(-_lightTarget.x(), _lightTarget.y(), _lightTarget.z()); _lightTarget=LTarget; LTarget=Vector3(-_lightRight.x(), _lightRight.y(), _lightRight.z()); _lightRight=LTarget; LTarget=Vector3(-_lightUp.x(), _lightUp.y(), _lightUp.z()); _lightUp=LTarget; LTarget=Vector3(-_lightStart.x(), _lightStart.y(), _lightStart.z()); _lightStart=LTarget; LTarget=Vector3(-_lightEnd.x(), _lightEnd.y(), _lightEnd.z()); _lightEnd=LTarget; } else if((scale.x()==1.0) && (scale.y()==-1.0) && (scale.z()==1.0)) { Vector3 LTarget; LTarget=Vector3(_lightTarget.x(), -_lightTarget.y(), _lightTarget.z()); _lightTarget=LTarget; LTarget=Vector3(_lightRight.x(), -_lightRight.y(), _lightRight.z()); _lightRight=LTarget; LTarget=Vector3(_lightUp.x(), -_lightUp.y(), _lightUp.z()); _lightUp=LTarget; LTarget=Vector3(_lightStart.x(), -_lightStart.y(), _lightStart.z()); _lightStart=LTarget; LTarget=Vector3(_lightEnd.x(), -_lightEnd.y(), _lightEnd.z()); _lightEnd=LTarget; } else if((scale.x()==1.0) && (scale.y()==1.0) && (scale.z()==-1.0)) { Vector3 LTarget; LTarget=Vector3(_lightTarget.x(), _lightTarget.y(), -_lightTarget.z()); _lightTarget=LTarget; LTarget=Vector3(_lightRight.x(), _lightRight.y(), -_lightRight.z()); _lightRight=LTarget; LTarget=Vector3(_lightUp.x(), _lightUp.y(), -_lightUp.z()); _lightUp=LTarget; LTarget=Vector3(_lightStart.x(), _lightStart.y(), -_lightStart.z()); _lightStart=LTarget; LTarget=Vector3(_lightEnd.x(), _lightEnd.y(), -_lightEnd.z()); _lightEnd=LTarget; } } } ... and added a call to it here void LightNode::evaluateTransform() { if (getType() == TRANSFORM_PRIMITIVE) { _light.mirror(getScale()); _light.translate(getTranslation()); _light.rotate(getRotation()); } else {... Not that this is the best way, I just use spotlights, flipping and 90 degree rotation a lot, so it was handy for me. I don't know if this is only happening for me.
  5. I think there's a problem if you try to mirror a spotlight too, but I can't quite follow how mirroring is applied to entities. Mirroring is done via scaling, but the light class doesn't seem to have any scaling functions.
  6. I noticed that if you do 90 degree rotations of spotlights via the menu you get a little floating point noise in the light's specifications. I made some code that makes the 90 degree rotation of spotlights clean. Doesn't seem to cause problems, though I don't know DarkRadiant well enough to really be sure. I modified void Light::rotate(const Quaternion& rotation) so that it detects 90 degree rotations and then uses flips and swaps to achieve that rotation rather than trigonometry. Here's the code, I don't know if you'd want this or not but feel free to use it if you do, GPL license. #define BZN_ROTEPSILON 0.000001 void Light::rotate(const Quaternion& rotation) { if (isProjected()) { Quaternion NewRotation = rotation; if( // X Axis 90 degree rotation (rotation.w()>-0.707107-BZN_ROTEPSILON) && (rotation.w()<-0.707107+BZN_ROTEPSILON) && (rotation.x()>-0.707107-BZN_ROTEPSILON) && (rotation.x()<-0.707107+BZN_ROTEPSILON) && (rotation.y()>0.0-BZN_ROTEPSILON) && (rotation.y()<0.0+BZN_ROTEPSILON) && (rotation.z()>0.0-BZN_ROTEPSILON) && (rotation.z()<0.0+BZN_ROTEPSILON) ) { Vector3 LTarget; LTarget=Vector3(_lightTarget.x(), -_lightTarget.z(), _lightTarget.y()); _lightTarget=LTarget; LTarget=Vector3(_lightRight.x(), -_lightRight.z(), _lightRight.y()); _lightRight=LTarget; LTarget=Vector3(_lightUp.x(), -_lightUp.z(), _lightUp.y()); _lightUp=LTarget; LTarget=Vector3(_lightStart.x(), -_lightStart.z(), _lightStart.y()); _lightStart=LTarget; LTarget=Vector3(_lightEnd.x(), -_lightEnd.z(), _lightEnd.y()); _lightEnd=LTarget; NewRotation=Quaternion(1.0, 0, 0, 0); } if( // Y Axis 90 degree rotation (rotation.w()>0.707107-BZN_ROTEPSILON) && (rotation.w()<0.707107+BZN_ROTEPSILON) && (rotation.x()>0.0-BZN_ROTEPSILON) && (rotation.x()<0.0+BZN_ROTEPSILON) && (rotation.y()>0.707107-BZN_ROTEPSILON) && (rotation.y()<0.707107+BZN_ROTEPSILON) && (rotation.z()>0.0-BZN_ROTEPSILON) && (rotation.z()<0.0+BZN_ROTEPSILON) ) { Vector3 LTarget; LTarget=Vector3(_lightTarget.z(), -_lightTarget.y(), _lightTarget.x()); _lightTarget=LTarget; LTarget=Vector3(_lightRight.z(), -_lightRight.y(), _lightRight.x()); _lightRight=LTarget; LTarget=Vector3(_lightUp.z(), -_lightUp.y(), _lightUp.x()); _lightUp=LTarget; LTarget=Vector3(_lightStart.z(), -_lightStart.y(), _lightStart.x()); _lightStart=LTarget; LTarget=Vector3(_lightEnd.z(), -_lightEnd.y(), _lightEnd.x()); _lightEnd=LTarget; NewRotation=Quaternion(1.0, 0, 0, 0); } if( // Z Axis 90 degree rotation (rotation.w()>-0.707107-BZN_ROTEPSILON) && (rotation.w()<-0.707107+BZN_ROTEPSILON) && (rotation.x()>0.0-BZN_ROTEPSILON) && (rotation.x()<0.0+BZN_ROTEPSILON) && (rotation.y()>0.0-BZN_ROTEPSILON) && (rotation.y()<0.0+BZN_ROTEPSILON) && (rotation.z()>-0.707107-BZN_ROTEPSILON) && (rotation.z()<-0.707107+BZN_ROTEPSILON) ) { Vector3 LTarget; LTarget=Vector3(-_lightTarget.y(), -_lightTarget.x(), -_lightTarget.z()); _lightTarget=LTarget; LTarget=Vector3(-_lightRight.y(), -_lightRight.x(), -_lightRight.z()); _lightRight=LTarget; LTarget=Vector3(-_lightUp.y(), -_lightUp.x(), -_lightUp.z()); _lightUp=LTarget; LTarget=Vector3(-_lightStart.y(), -_lightStart.x(), -_lightStart.z()); _lightStart=LTarget; LTarget=Vector3(-_lightEnd.y(), -_lightEnd.x(), -_lightEnd.z()); _lightEnd=LTarget; NewRotation=Quaternion(1.0, 0, 0, 0); } // Retrieve the rotation matrix... Matrix4 rotationMatrix = matrix4_rotation_for_quaternion(NewRotation); // ... and apply it to all the vertices defining the projection _lightTargetTransformed = rotationMatrix.transform(_lightTarget).getProjected(); _lightRightTransformed = rotationMatrix.transform(_lightRight).getProjected(); _lightUpTransformed = rotationMatrix.transform(_lightUp).getProjected(); _lightStartTransformed = rotationMatrix.transform(_lightStart).getProjected(); _lightEndTransformed = rotationMatrix.transform(_lightEnd).getProjected(); } else { m_rotation.rotate(rotation); } }
  7. It is pretty scary. I'm not the greatest programmer in the world, but it is nice to hear that someone else with better skills still thought it was a hard case.
  8. I've added the ability to set the detail flag back. [Edit: To my own version only.] I basically copied the "MakeVisportal" code, except that it goes through the brush faces setting them as detail. Seems to work except I haven't got undo functioning for it, but I haven't tested it very hard yet. Obviously not much use to TDM mappers, but I mention it just in case it comes up for someone else. DarkRadiant is a really cool editor, it'd be neat if it became the defacto map editor for the various Id related open source projects, though I realise this isn't the goal.
  9. I think the similarity is that func_statics don't break up the bsp space, and neither do brushes flagged as detail (in Q3A based engines). Although the big difference is that func_statics are treated as entities, whereas detail brushes are not. At least that's my understand from what I've read today.
  10. Checked XrealRadiant out, unfortunately it is just DarkRadiant with a different startup picture, and no "DetailBrush" option. Although I checked in their forum and they mentioned something about making the detail geometry a func_static. http://xreal-project.net/?page_id=3/level-.../detail-brushes I don't know about that, I'll have to check.
  11. Hmm, no, hadn't heard of that one. I haven't looked at XreaL in a while, I'll check it out, thanks.
  12. Ok, thanks. The lack of qer_trans is no biggie, especially since I have set the filters to hide the materials I wanted transparent. No detail/structural brush settings is a bit of a problem for me though, since I compile the bsp on a modified Q3Map2, and a simpler structural brush hull is preferred... I may have to try cludging something into the source code after all.
  13. I'm setting up DarkRadiant for use on a non-TDM project. Previously I was using GtkRadiant. So far it's going well, I have the textures showing in the editor and I've added a new .game file. A couple of quick questions though (I'll probably have more later on.) 1. Is there an equivalent of the qer_trans material keyword to make things show up in the editor partially transparent? 2. Is there a way to set brushes as structural or detail? It looks as if this option has been removed, it doesn't show up in the brush menu. The wiki article on keyboard shortcuts, http://wiki.thedarkmod.com/index.php?..._Keys_%26_Mouse, mentions these functions ("Make Detail" as Ctrl+M, "Make Structural" as Ctrl+Shift+S) but the shortcuts don't work. I notice that when I load maps made in GtkRadiant with the detail flag set, DarkRadiant preserves those flags on future saves, it just doesn't seem to allow you to change them.
  14. I'm building a project with the Ogre graphics library, the idea is to use the Q3A engine source, but with shadow mapping from shadow casting spotlights, small point lights from a deferred render stage, plus normal maps, specular maps... and maybe some SSAO. I also have a modified Q3Map2 for compiling, I'm already setup for compiling brush primitives and the Doom3 texture mapping matrices and can load the .bsp into Ogre (using my own loader rather than Ogre's outdated bsp scene manager.) Up till now I've been using a version of GtkRadiant I had as part of an old XreaL project, but just yesterday I discovered it has a fatal bug that I've got little chance of fixing, so the hunt was on for a new .map editor. I had modified that version of GtkRadiant to draw special wireframes for spotlights, and have special keys, so I was going to do that with DarkRadiant too. But I'd much rather use it without any change so I don't add bugs myself. So I'll probably change my other projects to use DarkRadiant's spotlights and points lights. Only tricky bit might be entities, but I'm not up to that yet, so I'll cross that bridge when I get there. The version I got compiled fine, and I may not need to do any modifications for a while, if at all, so it doesn't look like that's a problem.
  15. Yeah, the wiki does tell you the proper folder structure, I just missed it because I assumed the default svn structure would be correct. It was late at night, I'd spent many a frustrating hour (again) downloading various other Radiant sources that didn't work. My eye's had kinda glazed over at that point... So my fault.
×
×
  • Create New...