Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

106 Neutral

About Malonn

  • Rank

Personal Information

  • Role
    Amateur / Hobbyist
  • Interests

Recent Profile Visitors

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

  1. Quite true, quite true. Here's the function that calculates position of objects to be placed in the interior cell: ScriptName FnPopulatePlacementArray ; Ref rObjectRef Ref rInteriorDoor Ref rExteriorDoor Float fAngleFunc Float fIntDoorX Float fIntDoorY Float fIntDoorZ Float fIntDoorZRot Float fExtDoorX Float fExtDoorY Float fExtDoorZ Float fExtDoorZRot Float fObjX Float fObjY Float fObjZ Float fObjZRot Float fTempX Float fTempY Float fTempZ Short bDoneFlor Short bDoneCont Short bDoneActi Short bDoneFurn Short bDoneStat Short bDoneTree Short bDoneLite ; Begin Function { rInteriorDoor, rExteriorDoor, fAngleFunc } Let fIntDoorX := rInteriorDoor.GetPos X Let fIntDoorY := rInteriorDoor.GetPos Y Let fIntDoorZ := rInteriorDoor.GetPos Z Let fIntDoorZRot := rInteriorDoor.GetAngle Z Let fExtDoorX := rExteriorDoor.GetPos X Let fExtDoorY := rExteriorDoor.GetPos Y Let fExtDoorZ := rExteriorDoor.GetPos Z Let fExtDoorZRot := rExteriorDoor.GetAngle Z if (fIntDoorZRot > 360) Let fIntDoorZRot -= 360 endif if (fIntDoorZRot < 0) Let fIntDoorZRot += 360 endif if (fExtDoorZRot > 360) Let fExtDoorZRot -= 360 endif if (fExtDoorZRot < 0) Let fExtDoorZRot += 360 endif Label 1 if (rObjectRef != 0) ;start deploy Let fObjX := rObjectRef.GetPos X ; objectx Let fObjY := rObjectRef.GetPos Y Let fObjZ := rObjectRef.GetPos Z Let fTempX := (fObjX - fExtDoorX) ; tempdistancex Let fTempY := (fObjY - fExtDoorY) Let fTempZ := (fObjZ - fExtDoorZ) ; Let tempdistancehyp := (tempdistancex * tempdistancex + tempdistancey * tempdistancey) ; Let tempdistancehyp := sqrt tempdistancehyp ; Store base object: ar_Append DynLODq.avToPlace ( rObjectRef.GetBaseObject ) ; Store object's X position: ar_Append DynLODq.avToPlace ( fIntDoorX + fTempX * Cos fAngleFunc + fTempY * Sin fAngleFunc ) ; newobjectx ; Store object's Y position: ar_Append DynLODq.avToPlace ( fIntDoorY - fTempX * Sin fAngleFunc + fTempY * Cos fAngleFunc ) ; Store object's Z position: ar_Append DynLODq.avToPlace ( fIntDoorZ + fTempZ ) ; Store objects X rotation: ar_Append DynLODq.avToPlace ( rObjectRef.GetAngle X ) ; objectxrot ; Store object's Y rotation: ar_Append DynLODq.avToPlace ( rObjectRef.GetAngle Y ) ; Store object's Z rotation: Let fObjZRot := rObjectRef.GetAngle Z Let fObjZRot := (fAngleFunc + fObjZRot) % 360 if (fObjZRot > 360) Let fObjZRot -= 360 endif if (fObjZRot < 0) Let fObjZRot += 360 endif ar_Append DynLODq.avToPlace ( fObjZRot ) ; Store object's scale: ar_Append DynLODq.avToPlace ( rObjectRef.GetScale ) Let fTempX := (fObjX - fExtDoorX) + fIntDoorX Let fTempY := (fObjY - fExtDoorY) + fIntDoorY Let fTempZ := (fObjZ - fExtDoorZ) + fIntDoorZ Let rObjectRef := Apple Let rObjectRef := GetNextRef Goto 1 else Let rObjectRef := Apple if (bDoneStat == 0) Let rObjectRef := GetFirstRef 28 2 ; Let objecttypecode := 28 Let bDoneStat := 1 Goto 1 endif if (bDoneTree == 0) Let rObjectRef := GetFirstRef 30 1 ; Let objecttypecode := 30 Let bDoneTree := 1 Goto 1 endif if (bDoneLite == 0) Let rObjectRef := GetFirstRef 26 ; Let objecttypecode := 26 Let bDoneLite := 1 Goto 1 endif if (bDoneFlor == 0) Let rObjectRef := GetFirstRef 31 ; Let objecttypecode := 31 Let bDoneFlor := 1 Goto 1 endif if (bDoneCont == 0) Let rObjectRef := GetFirstRef 23 ; Let objecttypecode := 23 Let bDoneCont := 1 Goto 1 endif if (bDoneActi == 0) Let rObjectRef := GetFirstRef 18 ; Let objecttypecode := 18 Let bDoneActi := 1 Goto 1 endif if (bDoneFurn == 0) Let rObjectRef := GetFirstRef 32 ; Let objecttypecode := 32 Let bDoneFurn := 1 Goto 1 endif endif End Here's the function that takes the calculations for XYZ and actually places the objects: ScriptName FnPlaceInteriorObjects ; Array_var avIter Short iIterKey Ref rBigMesh Ref rInsideDoor Ref rIterTemp Ref rToPlace Float fMeshX Float fMeshY Float fMeshZ Float fMSize Float fPSize Float fXPos Float fYPos Float fZPos Float fXRot Float fYRot Float fZRot Float fScal ; Begin _Function { rBigMesh, rInsideDoor } Let fMeshX := rBigMesh.GetPos "X" Let fMeshY := rBigMesh.GetPos "Y" Let fMeshZ := rBigMesh.GetPos "Z" Let fMSize := rBigMesh.GetEditorSize Let avIter := ar_Construct "StringMap" ForEach avIter <- DynLODq.avToPlace Let iIterKey := avIter["key"] If ( iIterKey ) == 0 || ( iIterKey % 8 ) == 0 Let rIterTemp := *avIter Let fPSize := GetEditorSize rIterTemp Continue Endif If ( iIterKey ) == 1 || ( iIterKey % 8 ) == 1 ; X position Let fXPos := *avIter Continue Elseif ( iIterKey ) == 2 || ( iIterKey % 8 ) == 2 ; Y position Let fYPos := *avIter Continue Elseif ( iIterKey ) == 3 || ( iIterKey % 8 ) == 3 ; Z position Let fZPos := *avIter Continue Elseif ( iIterKey ) == 4 || ( iIterKey % 8 ) == 4 ; X rotation Let fXRot := *avIter Continue Elseif ( iIterKey ) == 5 || ( iIterKey % 8 ) == 5 ; Y rotation Let fYRot := *avIter Continue Elseif ( iIterKey ) == 6 || ( iIterKey % 8 ) == 6 ; Z rotation Let fZRot := *avIter Continue Elseif ( iIterKey ) == 7 || ( iIterKey % 8 ) == 7 ; Scale Let fScal := *avIter Endif ; "fMeshX/Y/Z" should be the center point of interior mesh along corresponding axes, ; the above should be <= X/Y/Z length divided by 2 If Abs(fXPos - fMeshX) <= 915 / 2 && Abs(fYPos - fMeshY) <= fMSize / 2 && Abs(fZPos - fMeshZ) <= fMSize / 2 Continue Endif Let rToPlace := rInsideDoor.PlaceAtMe rIterTemp 1, 0, 0 rToPlace.SetPos "X" fXPos rToPlace.SetPos "Y" fYPos rToPlace.SetPos "Z" fZPos rToPlace.SetAngle "X" fXRot rToPlace.SetAngle "Y" fYRot rToPlace.SetAngle "Z" fZRot rToPlace.SetScale fScal Loop End Any help would be appreciated.
  2. This is not as good as I first thought. Ground objects are missing. statics that make up the ground are missing. In my code, it's as if everything below a certain point are found to be intersecting with the AABB (rough) and not placed. Any ideas?
  3. Wyrframe's code is the most accurate using all of the guesses for stuff I have to use. It's very good. Hopefully I can iron out the kinks. Suggestions are always welcome.
  4. Yeah, I checked a few and the origin point varies. It's mostly in the center, but it's Z varies. I'll keep looking. I whipped up something using info here and this page and had positive results, but far from perfect. It ended up being stuff that should have been placed wasn't. I need to tighten it up. Not sure where to go from here. But, kudos to all here. You've been an immense help. But, hey, if you have more suggestions, keep them coming. I'm going to try Wyrframe's code real quick...
  5. I think the best tools I have to work with for accuracy are GetEditorSize and GetBoundingRadius, The former is my hunch for best results. From my Googling, the radius is not enough, I need the center and I need 4 points to calculate the center, which I don't have. Let me ask you all this: GetEditorSize supposedly returns Height + Width + Depth / 3. Can I get a decent approximation of axis range using that? Sorry for stupid questions, obviously math was never something I excelled in.
  6. Sounds simple enough, but one big (I think) problem. I don't have the center of the sphere. Just the radius. I have the coordinate of the mesh bound by the sphere. Same with bounding box; I have the coordinates of it's location (though where that point is relative to the mesh is a bit of a crap shoot). Is there a way to calculate center from what I do have? You all have narrowed this down from a big problem to one that is potentially solved, I'll just have to fudge the math some. Kinda guess at sizes. Having said that, keep the ideas coming. I'd rather it be more accurate than ballpark, but I can live with ballpark.
  7. I appreciate the help, but GetBoundingBox won't work. The box I need to check for intersection is a static; not mobile. A limitation of the extender, I suppose. The best on-the-fly approximation of size is "GetEditorSize". I can use GetBoundingSphere, though I'll have to strain Google's servers for the math to do it. If it can be done, that is.
  8. I love this forum. I guess I'll have to "fudge" the dimensions. I'll see if I can't figure out an average of all interior meshes. "GetBoundingBox"only works for projectiles and actors, so I can't use it. I'm placing everything except those two, basically. I can use this though, just guesstimate the numbers. Tedious editor work, but it is a solution. I can get the bounding radius... the math will be different and I don't know how to get there.
  9. Yeah, I'm Googling. You pointed out what I'm doing in simple terms so a whole new flood gate of info opened up. I found this formula: ( P x >= B m i n X ∧ P x <= B m a x X ) ∧ ( P y >= B m i n Y ∧ P y <= B m a x Y ) ∧ ( P z >= B m i n Z ∧ P z <= B m a x Z ) that detects if a point is inside an AABB. So how do I get the ranges of each axis (BmaxX, BminX, etc.)? I can easily get XYZ coordinates for the mesh in space, but where those coordinates are relative to the mesh, I don't know. It confuses me because the mesh ("X" to use the above post) is roughly a cube and the game only returns one set of XYZ coordinates for the cube to describe where it is. So, does the game have to provide me with "minX", "maxX", "minY", etc., etc.? Or can I calculate that somehow? I understand you all may not be familiar with the game's scripting language (it's TES IV Oblivion, by the way), so it may be harder to answer. Thanks again.
  10. Hey, Zakwayda. Sorry. Let me explain more clearly: I'm using a game's scripting (so it's not in C/C++) language. Basically, there is one mesh (an AABB or it may be an OBB--I'm fuzzy on the difference) placed in a cell, I'll call that mesh "X". At runtime via script, I'm placing game objects around this mesh (X). I'm just trying to detect if the objects being placed would intersect with the mesh (X). That's it. Because it's a game scripting language, what I have access to for calculations is limited. I can get the scale of "X" and the objects being placed around "X". I can get the "editor size" of "X" and the objects placed around it, which is documented as being a "rough scalar approximation of the dimensions", which is thought to be width + depth + height / 3. That's why I say I can get rough dimensions. There are other things I can work with, but those are the most important to me. And, of course, I can get the XYZ coordinates of the objects being placed around "X" and of "X".
  11. I have questions, sorry. How do I determine which axis the AABB is projected? The length of an edge can be just one of it's dimensions, right? My dimensions come from roughly x = L + W + H / 3. I have "x" in that formula and have to approximate the actual dimensions. Because what I'm working on is for a mod of a game, not actual game code, I'm limited to the scripting engine of the game.
  12. Hey, Septopus. Thanks for such a quick response. I think that may be exactly what I'm looking for. Two days of aimless Googling later, answers (at least I'm confident it'll solve my problem).
  13. I have a problem. Some of the numbers are going to be approximations. Here it is: I have rough dimensions of a cube. I have XYZ coordinates for the cube (I don't know where in the cube these coordinates originate--I just need a ballpark answer). I am drawing objects around the cube. Of course I have coordinates for each object being drawn. How can I tell if an object would be placed within the cube? I've been looking at (i.e. Googling) math to determine if a point intersects a line, but that's way too specific. I need to know if a point (XYZ coordinate) will be placed within the dimensions of a cube. I hope I'm being clear. Let me know what other info you need if you think it can be done. Thanks
  14. Malonn

    HLSL Bloom Shader Help

    Ok. Another update for those who may potentially see the problem: I got the shader to have an effect on the scene. Problem is, it's a negative effect. It's just a completely pitch black screen now. I kinda take that as something positive; better than not doing anything to the scene. Here's the updated shader (as you can see there is less of the OBGE semantics): // Simple Bloom Shader obtained from XNA Shader Programming static const bool description < string help = "Makes bright lights bleed their light into their surroundings."; > = true; iface float BloomIntensity < string help = "Controls the intensity of the bloom texture."; > = 1.30; iface float OriginalIntensity < string help = "Controls the intensity of the original scene texture."; > = 1.00; iface float BloomSaturation < string help = "Saturation amount on bloom."; > = 1.00; iface float OriginalSaturation < string help = "Saturation amount on original scene."; > = 1.00; texture2D ColorMap; sampler2D BloomSampler : register(s1); sampler2D ColorMapSampler = sampler_state { texture = <ColorMap>; AddressU = CLAMP; AddressV = CLAMP; MINFILTER = LINEAR; MAGFILTER = LINEAR; MIPFILTER = LINEAR; }; struct VSOUT { float4 vertPos : POSITION; float2 UVCoord : TEXCOORD0; }; struct VSIN { float4 vertPos : POSITION0; float2 UVCoord : TEXCOORD0; }; VSOUT DummyVS(VSIN IN) { VSOUT OUT = (VSOUT)0.0f; // initialize to zero, avoid complaints. OUT.vertPos = IN.vertPos; OUT.UVCoord = IN.UVCoord; return (OUT); } float4 AdjustSaturation(float4 Color, float Saturation) { float Grey = dot(Color, float4(0.3, 0.59, 0.11, 0.0)); return lerp(Grey, Color, Saturation); } float4 BloomShader(float2 Tex : TEXCOORD0) : COLOR0 { float4 bloomColor = tex2D(BloomSampler, Tex); float4 originalColor = tex2D(ColorMapSampler, Tex); bloomColor = AdjustSaturation(bloomColor, BloomSaturation) * BloomIntensity; originalColor = AdjustSaturation(originalColor, OriginalSaturation) * OriginalIntensity; originalColor *= (1 - saturate(bloomColor)); return originalColor + bloomColor; } technique main < int group = EFFECTGROUP_POST; int fxclass = EFFECTCLASS_COLOR; > { pass p0 { VertexShader = compile vs_1_1 DummyVS(); PixelShader = compile ps_2_0 BloomShader(); } } Well, hopefully a guru will peek at this thread and see something glaring.
  15. Malonn

    HLSL Bloom Shader Help

    Thanks! Well the OP problem was that there was a solid white oval in the middle of my screen "attached" to my crosshair. I fixed that. Now the problem is that the bloom effect is not being applied to the scene, at all. I adjust the settings and there is no change to the image. I guess this forum is going to be more helpful with HLSL specific problems, and not so much OBGEv3 specific problems. At first I thought it was an HLSL problem, but now I'm thinking it's OBGEv3. Hopefully I can figure it out, or someone around these here parts is familiar with OBGEv3. Gotta try, you know how it is.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!